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\).
Interpreting Your Ratio Result
The simplified ratio A:B is the same comparison as your original numbers, written with the smallest whole numbers possible. If the result is \(a':b'\), then for every \(a'\) units of A there are \(b'\) units of B. For example, 18 and 24 simplify to 3:4, so for every 3 units of A there are 4 units of B.
The calculator divides both numbers by their greatest common divisor (GCD):
$$a' = \frac{A}{\gcd(A,B)}, \quad b' = \frac{B}{\gcd(A,B)}$$
A GCD of 1 means the two numbers share no common factor other than 1, so the ratio is already in lowest terms (for example, 7:13). A GCD greater than 1 means the ratio could be reduced. With 18 and 24 the GCD is 6.
Reading the decimal
The decimal value \(A \div B\) is equal to \(a'/b'\), because dividing both numbers by the same GCD does not change the quotient.
- A decimal above 1 means A is larger than B (for example, 12:8 = 3:2 = 1.5).
- A decimal below 1 means A is smaller than B (for example, 3:4 = 0.75).
- A decimal of exactly 1 means A and B are equal (1:1).
Converting to a fraction or percentage
A ratio \(a':b'\) can be read as the fraction \(\frac{a'}{b'}\), meaning A as a part of B. For 3:4:
$$\frac{3}{4} = 0.75 = 75\%$$
So A is 75% of B. To express A as a share of the total, divide by the sum of the parts:
$$\frac{3}{3+4} = \frac{3}{7} \approx 42.9\%$$
B is then \(\frac{4}{7} \approx 57.1\%\) of the total.
Scaling quantities
Multiply both parts of the simplified ratio by the same number to get equivalent ratios. Starting from 3:4, multiplying by 2 gives 6:8, and multiplying by 3 gives 9:12. All of these describe the same proportion, which is useful when scaling a recipe, a mix, or a drawing up or down.
Ratio Examples Compared
The table shows how different pairs of numbers reduce. The decimal is A ÷ B.
| A | B | GCD | Simplified ratio | Decimal A÷B |
|---|---|---|---|---|
| 18 | 24 | 6 | 3:4 | 0.75 |
| 12 | 8 | 4 | 3:2 | 1.5 |
| 7 | 13 | 1 | 7:13 | ≈ 0.5385 |
| 10 | 10 | 10 | 1:1 | 1 |
| 5 | 100 | 5 | 1:20 | 0.05 |
| 1.5 | 2 | 5 (after scaling to 15:20) | 3:4 | 0.75 |
Notes on the rows
- 18 and 24: both divide by 6, giving 3 and 4.
- 12 and 8: both divide by 4, giving 3 and 2. The decimal is above 1 because A is larger than B.
- 7 and 13: both are prime, so the GCD is 1 and the ratio cannot be reduced. The decimal \(7 \div 13 \approx 0.5385\).
- 10 and 10: equal numbers always reduce to 1:1.
- 5 and 100: dividing by 5 gives 1:20, so B is 20 times A.
- 1.5 and 2: decimals are first scaled to whole numbers by multiplying both by 10, giving 15:20. The GCD of 15 and 20 is 5, so the result is 3:4, the same as 18:24.
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\).