curatedapi

Fraction calculator

Add, subtract, multiply, divide and simplify fractions and mixed numbers, with the exact repeating decimal.

What to do. Options: simplify: reduce a to lowest terms; add: a + b; subtract: a − b; multiply: a × b; divide: a ÷ b
First fraction, e.g. '3/4', '-1 1/2' or '0.75'. At most 200 characters.
Second fraction (not used by simplify). At most 200 characters.
More options: rounding and decimals
Precision and rounding
Rounding mode applied once to each result. Default half_even.
Round results to this many digits after the decimal point.
Round results to this many significant digits.

Examples

Result: 1/3 + 1/6

Fraction
Result in lowest terms, e.g. '1/2' or '3'.
1/2
Numerator
Numerator in lowest terms (a string, since it can exceed JavaScript's safe integer range).
1
Denominator
Denominator in lowest terms (always positive).
2
Mixed number
Result as a mixed number, e.g. '1 1/2'.
1/2
Decimal
Result as a rounded decimal.
0.5 exact
Repeating decimal
Exact decimal with the repeating block in parentheses.
0.5
Is terminating
True when the decimal expansion ends.
yes

Rounding: Half even, 20 significant digits. Calculator math/fraction@1.

How it is calculated

a/b + c/d = (ad + bc)/bd, then reduced by the greatest common divisor

Works with exact fractions such as 3/4, mixed numbers such as 1 1/2, and decimals. Results are always in lowest terms and include the mixed number, a rounded decimal and the exact decimal expansion with its repeating block in parentheses (1/6 = 0.1(6)).

References

Results follow each calculator's documented rules and the sources listed. They are not financial, tax or legal advice. Check that the rules fit your case before you rely on a result. See the terms.

Use it from your code

POST /v1/calc/math/fractionVersion 1
curl https://api.curatedapi.com/v1/calc/math/fraction \
  -H "Authorization: Bearer $CURATEDAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "operation": "add",
    "a": "1/3",
    "b": "1/6"
  }'
The same call in Python
import os

import requests

payload = {
    "operation": "add",
    "a": "1/3",
    "b": "1/6",
}
response = requests.post(
    "https://api.curatedapi.com/v1/calc/math/fraction",
    headers={"Authorization": f"Bearer {os.environ['CURATEDAPI_KEY']}"},
    json=payload,
    timeout=10,
)
print(response.json()["result"])
The same call in JavaScript
const payload = {
    "operation": "add",
    "a": "1/3",
    "b": "1/6",
};
const response = await fetch("https://api.curatedapi.com/v1/calc/math/fraction", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.CURATEDAPI_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify(payload),
});
console.log((await response.json()).result);

MCP tool calc_math_fraction at https://mcp.curatedapi.com. Inputs, outputs and errors in the API reference.

Put it on your website

<div data-curatedapi-widget="math/fraction" data-key="capi_public_…"></div>
<script src="https://widgets.curatedapi.com/v1/widget.js" async></script>

Use a public key registered for your site. Calculations are billed like API calls. How widgets work.

Related calculators

Add this calculator to your website

Paste two lines into your page and your visitors get this calculator. Each use counts as one call on your plan, the same as the API.

Free for up to 1,000 uses a month. 50,000 uses a month cost $9.00 on the Starter plan.