What is the Ratio of 2 Numbers Calculator?
This calculator takes any two numbers, A and B, and expresses their relationship as a ratio reduced to its simplest form. A ratio compares two quantities — for example, \(18:24\) simplifies to \(3:4\), meaning for every 3 units of A there are 4 units of B. Reducing a ratio makes it easier to read, compare, and scale.
How to use it
Enter your first number in field A and your second number in field B, then read the result. The tool shows the simplified ratio (A:B in lowest terms), the greatest common divisor (GCD) used to reduce it, and the ratio expressed as a single decimal (A ÷ B). Decimal inputs are supported — they are scaled to whole numbers before reducing, so \(1.5:2\) becomes \(3:4\).
The formula explained
To simplify a ratio, find \(g\), the greatest common divisor of the two numbers, using the Euclidean algorithm. Then divide each number by \(g\):
$$a : b = (a \div g) : (b \div g)$$
The Euclidean algorithm repeatedly replaces the larger number with the remainder of dividing the two values until one becomes zero; the other is the GCD.
Worked example
Take \(A = 18\) and \(B = 24\). The divisors of 18 are 1, 2, 3, 6, 9, 18 and of 24 are 1, 2, 3, 4, 6, 8, 12, 24. The greatest common divisor is 6. Dividing both gives $$18 \div 6 = 3$$ and $$24 \div 6 = 4,$$ so the simplified ratio is 3:4. As a decimal, \(3 \div 4 = 0.75\).
FAQ
Can I use decimals? Yes. The calculator scales both inputs by a power of ten so they become integers, then reduces. For example \(0.5:0.2\) becomes \(5:2\).
What if one number is zero? If B is 0 the decimal value is undefined and shown as 0; the ratio still reduces using the non-zero value.
Does order matter? Yes — A:B is not the same as B:A. \(3:4\) describes a different relationship than \(4:3\).