Quick answer
To simplify a ratio, divide both terms by their greatest common divisor. Enter the two terms and the calculator returns the simplest whole-number ratio, the first term as a fraction of the total and the decimal value of A ÷ B.
12 : 18 simplifies to 2 : 3 because the greatest common divisor of 12 and 18 is 6. The first term is 2 of the 5 parts in total, which is 2/5, and A ÷ B = 0.666667.
Related tools: Ratio Percentage Calculator: Percentage share of each part of a ratio. Percent to Ratio Calculator: Express a percentage as a part-to-whole ratio. Ratio to Decimal Calculator: Convert a ratio a:b to a decimal.
How to use the Ratio Calculator
- Enter first number (A) (a whole number, 0 or more).
- Enter second number (B) (a whole number, 0 or more).
- Press Calculate to see the result, and use Reset to start again.
| Input | What to enter | Allowed values |
|---|---|---|
| First number (A) | A whole number | ≥ 0 |
| Second number (B) | A whole number | ≥ 0 |
Formula and method
Formula
A : B = (A ÷ gcd) : (B ÷ gcd)
IEEE-754 double precision; shown to at most 6 decimal places.
Divide both terms by their greatest common divisor.
Worked examples
These examples are verified: each one is an automated test case that the live calculator must reproduce exactly.
Example 1
Inputs: First number (A) = 12; Second number (B) = 18.
| Result | Value |
|---|---|
| Simplified ratio | 2:3 |
| A as fraction of total | 2/5 |
| Decimal A ÷ B | 0.666667 |
Example 2
Inputs: First number (A) = 5; Second number (B) = 0.
| Result | Value |
|---|---|
| Simplified ratio | 1:0 |
| A as fraction of total | 1 |
| Decimal A ÷ B | — |
Example 3
Inputs: First number (A) = 7; Second number (B) = 7.
| Result | Value |
|---|---|
| Simplified ratio | 1:1 |
| A as fraction of total | 1/2 |
| Decimal A ÷ B | 1 |
The first line is the headline result (simplified ratio). Below it the ratio Calculator lists a as fraction of total and decimal A ÷ B, which describe the same case from other angles. IEEE-754 double precision; shown to at most 6 decimal places.
Simplifying and splitting
12:18 simplifies to 2:3 after dividing both by their greatest common divisor, 6. A's share of the total is 12/30 = 2/5.
To split 50 in the ratio 2:3, divide by the 5 total parts (10 each) and scale: 20 and 30. The same method scales recipes.
Simplifying 12 : B for different values of B
Every figure in this table comes from running this calculator, so it matches what the form returns.
| B | Simplified ratio | A as fraction of total |
|---|---|---|
| 18 | 2:3 | 2/5 |
| 20 | 3:5 | 3/8 |
| 30 | 2:5 | 2/7 |
| 45 | 4:15 | 4/19 |
What happens with invalid input
These messages are produced by the calculator itself, so you know what to fix.
- Second number (B): entering "0" shows "At least one term must be greater than 0." beside that field and no result.
Choosing between the Ratio Calculator and similar calculators
Each row shows what a related calculator on this site asks for and what it returns, so you can pick the one that matches your question.
| Calculator | You enter | It returns |
|---|---|---|
| [Ratio Percentage Calculator](/math/ratio-percentage-calculator/) | part A and part B | Part A |
| [Percent to Ratio Calculator](/math/percent-to-ratio-calculator/) | percent | Ratio |
| [Ratio to Decimal Calculator](/math/ratio-to-decimal-calculator/) | a and b | Decimal |
| [Fraction to Ratio Calculator](/math/fraction-to-ratio-calculator/) | numerator and denominator | Ratio |
| [Decimal to Ratio Calculator](/math/decimal-to-ratio-calculator/) | decimal | Ratio |
Background: rounding and basic arithmetic
Rounding to a place looks at the digit just to its right: 0 to 4 rounds down and 5 to 9 rounds up (the half-up convention, so 2.5 becomes 3). Rounding 838.274 gives 800 to the nearest hundred, 840 to the nearest ten and 838 to the nearest one.
Some systems use banker's rounding (half to even), which sends 2.5 to 2 and 3.5 to 4; check which convention your task requires, and round only at the end of a multi-step calculation.
Assumptions and limitations
- Both terms 0 is invalid
- Whole numbers only
If a required value is empty, not a number, or outside its allowed range, the form marks that field with a message and shows no result instead of a misleading number. The automated checks deliberately try invalid entries for second number (B) to confirm this.
Frequently asked questions
How do I split 50 in the ratio 2:3?
There are 5 parts, so each is 10. The shares are 20 and 30.
What is the greatest common divisor?
The largest number that divides both values. For 12 and 18 it is 6.
What does the Ratio Calculator calculate?
Simplify a ratio of two whole numbers. It returns Simplified ratio, A as fraction of total and Decimal A ÷ B.
What formula does the Ratio Calculator use?
A : B = (A ÷ gcd) : (B ÷ gcd). Divide both terms by their greatest common divisor.
What do I need to enter in the ratio Calculator?
You enter First number (A) and Second number (B).
How is the result rounded or limited?
IEEE-754 double precision; shown to at most 6 decimal places. Both terms 0 is invalid.
What are the limits of this calculator?
Both terms 0 is invalid. Whole numbers only.
What is an example of a ratio result?
With first number (A) 12 and second number (B) 18, the simplified ratio is 2:3.
Related calculators
- Ratio Percentage Calculator — Percentage share of each part of a ratio.
- Percent to Ratio Calculator — Express a percentage as a part-to-whole ratio.
- Ratio to Decimal Calculator — Convert a ratio a:b to a decimal.
- Fraction to Ratio Calculator — Convert a fraction to a ratio.
- Decimal to Ratio Calculator — Convert a decimal to a ratio.
- Ratio to Fraction Calculator — Convert a ratio a:b to a fraction a/b.
Sources
- OpenStax, Prealgebra 2e (Rice University): fractions, decimals, percents, ratios and rounding
Content last reviewed 2026-11-04. Formulas and worked examples are checked by automated tests against independently computed values.