How to use the ratio calculator
- In the ratio calculator, choose Simplify a ratio or Solve for x (proportion) in the Mode menu.
- To simplify, enter A and B. Decimals and negatives are allowed; leave C empty.
- To solve, enter A, B and the third number in the C box, then pick the unknown in Solve for.
- Read the result rows: the simplified ratio, its decimal value and the GCD, or the missing value with the full proportion.
Simplifying with the greatest common divisor
A ratio A:B is in lowest terms when A and B share no common factor except 1. The tool finds the greatest common divisor (GCD) with Euclid's algorithm (Elements, Book VII): repeatedly replace the pair (a, b) by (b, a mod b) until the remainder is zero. For 12 and 8 the steps are (12, 8), (8, 4), (4, 0), so the GCD is 4 and the result is 3:2.
Decimals are first scaled to whole numbers. For 0.5:1.5 the tool multiplies both by 10 to get 5:15, finds GCD 5, and returns 1:3. The GCD row is reported in your original units, so it shows 0.5 here, because 0.5 x 3 = 1.5 and 0.5 x 1 = 0.5.
Solving A:B = C:D
Two ratios are in proportion when A/B = C/D, which cross-multiplies to A x D = B x C. In Solve mode the third number goes in the C box.
- x in A:B = C:x: x = B x C / A. For 5:3 = 750:x the tool returns x = 450, shown as 5 : 3 = 750 : 450.
- C in A:B = C:D: C = A x D / B, with the known D typed in the C box. For 5:7 = C:21 it returns C = 15.
Check 5:3 = 750:450 by dividing both by their GCD: 5/3 and 750/450 = 5/3.
Edge cases and what is rejected
Real outputs of the ratio calculator:
- Negative on both sides: -6:-9 gives 2 : 3. One negative side: 6:-9 gives -2 : 3, with the minus sign moved to the first term.
- 0:5 gives 0 : 1, because gcd(0, 5) = 5.
- 5:0 gives 1 : 0 and a decimal of Infinity.
- 0:0 is an error, since every pair divides 0.
- 1.234567:1 gives 1,234,567 : 1,000,000, because decimals are scaled by powers of 10 up to 12 places.
- Solve with A = 0 (solving x) or B = 0 is an error, because the formula divides by that value.
- 2:3 = 0:x returns x = 0.
Results are trimmed to 12 significant digits, and the decimal row shows up to 10 decimal places: 1920:1080 gives 1.7777777778.
Method and sources
Simplification and proportion solving use only integer division, the remainder operation and cross-multiplication. Euclid's algorithm for the GCD is in Book VII of the Elements, and the equality of ratios is the theory of proportion in Book V. Because the tool works on a number you type rather than on measured data, the result is exact whenever the inputs are whole numbers or short decimals; very long decimals are limited by binary floating point.
Common ratios and their lowest terms
| Original | Lowest terms | GCD |
|---|---|---|
| 1920:1080 | 16:9 | 120 |
| 21:9 | 7:3 | 3 |
| 100:25 | 4:1 | 25 |
| 12:8 | 3:2 | 4 |
| 7.5:2.5 | 3:1 | 2.5 |
For screen shapes specifically, see the aspect ratio calculator. To turn a ratio into a fraction or decimal use the fraction calculator.
Worked examples
| Example | Input | Result |
|---|---|---|
| Simplify 12:8 | Mode: simplify; A (first number): 12; B (second number): 8; Solve for: x | Simplified ratio: 3 : 2; As a decimal (A / B): 1.5; Multiplier used: GCD = 4 |
| Solve 3:4 = 9:x | Mode: solve; A (first number): 3; B (second number): 4; C (third number): 9; Solve for: x | x: 12; Proportion: 3 : 4 = 9 : 12; Formula used: x = (B × C) / A |
| Solve 5:7 = C:21 | Mode: solve; A (first number): 5; B (second number): 7; C (third number): 21; Solve for: c | C: 15; Proportion: 5 : 7 = 15 : 21; Formula used: C = (A × D) / B |
| Simplify 0.5:1.5 | Mode: simplify; A (first number): 0.5; B (second number): 1.5; Solve for: x | Simplified ratio: 1 : 3; As a decimal (A / B): 0.3333333333; Multiplier used: GCD = 0.5 |
FAQ
Why does 0.5:1.5 show a GCD of 0.5?
The tool scales 0.5:1.5 to 5:15, whose GCD is 5, then divides by the scale factor 10 to report the divisor in your original units: 0.5.
Where do I type the known number when solving for C?
In the box labelled C. With Solve for set to C in A:B = C:D, that box is read as D, and the result row is labelled C.
What does 6:-9 simplify to?
-2 : 3. When only one side is negative, the tool keeps the minus sign on the first term. If both sides are negative, as in -6:-9, the signs cancel and the result is 2 : 3.
Why is 5:0 not an error?
A zero second term still has a defined lowest form, 1 : 0, and the decimal row reads Infinity. Only 0:0 is rejected in Simplify mode.
Why does solving 2:0 = 5:x fail?
The formula x = B x C / A needs a valid proportion, and B = 0 would make the left ratio infinite. The tool returns an error instead of Infinity or NaN.
Is the decimal row rounded?
It is the quotient A / B trimmed to 12 significant digits and shown with at most 10 decimal places, so 17:5 shows 3.4 and 1920:1080 shows 1.7777777778.
How do I scale a recipe with the ratio calculator?
Solve the proportion. For flour to water 5:3 with 750 g of flour, enter A = 5, B = 3, C = 750 and read x = 450 g of water.