{
  "id": "fraction",
  "version": "08716e745067",
  "status": "published",
  "name": "Fraction Calculator",
  "question": "How do I calculate with fractions?",
  "summary": "Adds, subtracts, multiplies, or divides two fractions exactly, and shows the answer in lowest terms, as a mixed number, as a decimal, and step by step.",
  "category": "math",
  "subcategory": "arithmetic",
  "url": "https://www.acalculator.org/math/fraction-calculator",
  "markdown": "https://www.acalculator.org/math/fraction-calculator.md",
  "kind": "function",
  "method": "a/b + c/d = (a × (L ÷ b) + c × (L ÷ d))/L with L the least common denominator; a/b × c/d = ac/bd; a/b ÷ c/d = a/b × d/c; then reduce by the greatest common factor.",
  "assumptions": [
    "All arithmetic is exact, with whole-number numerators and denominators of any size.",
    "A mixed number such as 1 1/2 means 1 + 1/2; a minus sign applies to the whole number: −1 1/2 = −3/2.",
    "Each fraction is put in lowest terms before the working is shown.",
    "Dividing by 0 has no answer."
  ],
  "inputs": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "a": {
        "title": "First fraction",
        "description": "A fraction, mixed number, or whole number, such as 1/2, 1 1/2, or 3.",
        "type": "string",
        "pattern": "^-?\\d+( \\d+)?(/\\d+)?$"
      },
      "op": {
        "title": "Operation",
        "description": "Add, subtract, multiply, or divide the first fraction by the second.",
        "type": "string",
        "enum": [
          "+",
          "-",
          "*",
          "/"
        ]
      },
      "b": {
        "title": "Second fraction",
        "description": "A fraction, mixed number, or whole number, such as 1/3, 2 1/4, or 5.",
        "type": "string",
        "pattern": "^-?\\d+( \\d+)?(/\\d+)?$"
      }
    }
  },
  "outputs": {
    "result": {
      "label": "Answer",
      "description": "The answer as one fraction in lowest terms, such as 5/6 or 7/4.",
      "format": "text"
    },
    "mixed": {
      "label": "As a mixed number",
      "description": "The answer as a whole number and a proper fraction, such as 1 3/4.",
      "format": "text"
    },
    "decimal": {
      "label": "As a decimal",
      "description": "The answer as a decimal.",
      "format": "number"
    },
    "steps": {
      "label": "Working",
      "description": "How the answer is found, from the two fractions to lowest terms.",
      "format": "text"
    },
    "problem": {
      "label": "Problem",
      "description": "The two fractions in lowest terms with the operation, written as the working writes them.",
      "format": "text"
    }
  },
  "defaultAnswer": {
    "inputs": {
      "a": "1/2",
      "op": "+",
      "b": "1/3"
    },
    "outputs": {
      "result": "5/6",
      "mixed": "5/6",
      "decimal": 0.8333333333333334,
      "steps": "1/2 + 1/3 = 3/6 + 2/6 = 5/6",
      "problem": "1/2 + 1/3"
    },
    "text": "1/2 + 1/3 = 5/6."
  },
  "examples": [
    {
      "given": {
        "a": "1/2",
        "op": "+",
        "b": "1/3"
      },
      "expect": {
        "result": "5/6",
        "mixed": "5/6",
        "decimal": 0.8333333333333334,
        "steps": "1/2 + 1/3 = 3/6 + 2/6 = 5/6"
      },
      "source": "hand calculation in content.mdx: 3/6 + 2/6 = 5/6; Python 3: fractions.Fraction(1, 2) + Fraction(1, 3) = 5/6"
    },
    {
      "given": {
        "a": "3/4",
        "op": "-",
        "b": "5/6"
      },
      "expect": {
        "result": "-1/12",
        "decimal": -0.08333333333333333,
        "steps": "3/4 − 5/6 = 9/12 − 10/12 = -1/12"
      },
      "source": "hand calculation in content.mdx: 9/12 − 10/12 = −1/12"
    },
    {
      "given": {
        "a": "2/3",
        "op": "*",
        "b": "9/4"
      },
      "expect": {
        "result": "3/2",
        "mixed": "1 1/2",
        "decimal": 1.5,
        "steps": "2/3 × 9/4 = (2 × 9)/(3 × 4) = 18/12 = 3/2"
      },
      "source": "hand calculation in content.mdx: 18/12 = 3/2 = 1 1/2"
    },
    {
      "given": {
        "a": "5/8",
        "op": "/",
        "b": "3/4"
      },
      "expect": {
        "result": "5/6",
        "steps": "5/8 ÷ 3/4 = 5/8 × 4/3 = 20/24 = 5/6"
      },
      "source": "hand calculation in content.mdx: 5/8 × 4/3 = 20/24 = 5/6"
    },
    {
      "given": {
        "a": "1 1/2",
        "op": "+",
        "b": "2 2/3"
      },
      "expect": {
        "result": "25/6",
        "mixed": "4 1/6",
        "decimal": 4.166666666666667
      },
      "source": "hand calculation in content.mdx: 3/2 + 8/3 = 9/6 + 16/6 = 25/6 = 4 1/6"
    },
    {
      "given": {
        "a": "7/10",
        "op": "/",
        "b": "-2/5"
      },
      "expect": {
        "result": "-7/4",
        "mixed": "-1 3/4",
        "steps": "7/10 ÷ (-2/5) = 7/10 × (-5/2) = -35/20 = -7/4"
      },
      "source": "hand calculation in content.mdx: 7/10 × (−5/2) = −35/20 = −7/4"
    }
  ],
  "sources": [
    "OpenStax, Prealgebra 2e, section 4.2 Multiply and Divide Fractions: https://openstax.org/books/prealgebra-2e/pages/4-2-multiply-and-divide-fractions",
    "OpenStax, Prealgebra 2e, section 4.5 Add and Subtract Fractions with Different Denominators: https://openstax.org/books/prealgebra-2e/pages/4-5-add-and-subtract-fractions-with-different-denominators"
  ],
  "related": [
    "mixed-numbers",
    "gcf",
    "lcm",
    "ratio"
  ],
  "changelog": [
    {
      "date": "2026-09-28",
      "note": "The answer sentence writes each fraction as the working does (9/4, not 2 1/4) and brackets a negative second one."
    }
  ]
}
