piapia123
en

Fraction Calculator

Convert

Everything runs locally in your browser — nothing is uploaded

Input
Drop a file here to load its contents
Output

Four kinds of input, detected automatically with no mode to pick: `24/36` is a simplification, `24 36` is a pair of integers for GCD and LCM, `0.75` is a decimal to convert, and `1/2 + 1/3` is arithmetic. These look easy, but two things bite: least common multiples grow extremely fast (a few ten-digit numbers take the result past 2^53), and in fraction arithmetic the denominators multiply just as quickly. Ordinary JavaScript numbers lose the low digits without raising an error, so everything here goes through BigInt and stays exact at any size. Decimal-to-fraction conversion is exact too — 0.1 really is 1/10, not an approximation of it.

Features

  • Simplify a fraction, with the GCD that was used
  • GCD and LCM for two integers, plus whether they are coprime
  • Decimals to fractions — an exact conversion, not an approximation
  • Fraction arithmetic (add, subtract, multiply, divide) with automatic simplification
  • Improper fractions also shown as mixed numbers
  • Decimal values to 12 places for fractions that have one
  • Optional continued-fraction approximation: π converges to 355/113
  • BigInt throughout, so large integers keep every digit

How to use

  1. Paste a fraction, two integers, a decimal or an expression — the type is detected
  2. The result appears as you type
  3. Turn on the continued-fraction option if you want a simple approximation
  4. Copy any single line with its own button

FAQ

Why does the LCM need BigInt?
Because it grows fast: the LCM of 21 and 6 is 42, but two adjacent ten-digit numbers give a 20-digit result. Past 2^53 ordinary JavaScript numbers drop the low digits without complaining, leaving a number that looks fine and is wrong. GCD and LCM exercises land on exactly that size.
Is 0.1 to a fraction exact here?
Yes. Converting a decimal literal to a fraction is exact by definition: 0.1 means one tenth. (Separately, 0.1 is a repeating fraction in binary floating point — a different matter; this tool parses the string and never goes through floats.)
What is the continued-fraction approximation?
A way of approximating any real number by simple fractions in which each step is the closest fraction whose denominator is within a given bound. π is approached as 3, 22/7, 333/106, 355/113 — the last accurate to six decimal places with a three-digit denominator. Handy for engineering estimates.
Are negatives and mixed numbers supported?
Negatives are: `-24/36` and `1/-2` both work, and the result is normalised to a single form (the sign moves to the numerator). Mixed numbers like `2 1/3` have to be written as an improper fraction first (`7/3`), because the "two integers" form is already taken by GCD/LCM and the two cannot be told apart.

Related tools