Ratio Calculator
Simplifies a ratio a:b by dividing both sides by their greatest common divisor, solves the proportion a:b = c:x with x = b times c divided by a, or scales both sides by a chosen factor. Decimal inputs are multiplied up to whole numbers before reducing. Also reports the ratio as the single decimal a divided by b and the first value as a share of the total a plus b.
Enter two numbers and the calculator treats them as the two sides of a ratio. In simplify mode it reduces the pair to its lowest whole-number terms, so 12:18 comes back as 2:3. In find-the-missing-value mode it solves the proportion a:b = c:x for the unknown fourth term, and in scale mode it multiplies both sides by a factor of your choosing, resizing a recipe, a mixture or a drawing without changing its character. Alongside the main result it always shows two companion figures: the ratio as a single decimal, the first value divided by the second, and the first value as a share of the total, the percentage most people actually want.
What the three modes compute
Simplifying divides both sides by the largest whole number that goes into each of them exactly, their greatest common divisor:
a:b = (a ÷ g) : (b ÷ g), where g is the greatest common divisor of a and b
The divisor is found by repeated remainders: divide the larger side by the smaller, keep the remainder, then repeat with the smaller side and that remainder until nothing is left over. The last nonzero remainder is the greatest common divisor. For 12 and 18, dividing 18 by 12 leaves 6, and 12 divides by 6 exactly, so the divisor is 6 and the ratio reduces to 2:3. When a side carries decimals, the calculator first multiplies both sides by the power of ten that clears every decimal place, reading up to nine places, and rounds the results to whole numbers, so 2.5:7.5 becomes 25:75 before reducing to 1:3.
Solving rests on cross-multiplication. The statement a:b = c:x makes the quotients a ÷ b and c ÷ x equal; multiplying both sides by b and by x gives a × x = b × c, and dividing by a isolates the unknown:
x = b × c ÷ a
Scaling multiplies both sides by the same factor:
a:b becomes (a × k) : (b × k)
Because both sides grow or shrink together, the scaled ratio is equivalent to the original and the decimal output does not move: the numbers change, the relationship does not.
The defaults worked through by hand
Simplify starts from 12:18. The greatest common divisor of 12 and 18 is 6, so both sides divide by 6 and the result reads 2:3. The decimal is 12 ÷ 18 = 0.6667 to four places, and the share of the total is 12 ÷ (12 + 18) = 12 ÷ 30 = 0.4, displayed as 40 percent.
Switching to find the missing value adds a third number, 10, and asks for the x in 12:18 = 10:x. Cross-multiplying gives x = 18 × 10 ÷ 12 = 180 ÷ 12 = 15, so the completed proportion is 12:18 = 10:15. As a check, 10:15 reduces by 5 to 2:3, the same lowest terms as 12:18.
Scale mode multiplies 12:18 by the default factor 2.5, giving 12 × 2.5 = 30 against 18 × 2.5 = 45, and 30 ÷ 45 lands on the same 0.6667 as before.
The same arithmetic resizes a recipe. If 6 servings need 300 grams of flour, the servings-to-flour ratio is 6:300, cooking for 9 means solving 6:300 = 9:x, and cross-multiplication gives x = 300 × 9 ÷ 6 = 450 grams. Scale mode reaches the same answer with a factor of 1.5.
A ratio is not quite a fraction
Confusing the two is the most common way to misread a ratio. A two-part ratio ordinarily compares part with part, while a fraction names part of a whole. In a room where the ratio of adults to children is 2:3, adults are not two thirds of the room; they are two fifths of it, because the room holds 2 + 3 = 5 equal shares. The fraction corresponding to the first side is therefore the first value over the total of both, which is what the share output reports: 40 percent for 2:3. The decimal output, 2 ÷ 3 = 0.6667, is a third quantity again: 0.6667 adults for every child, a rate of one part against the other rather than a slice of the whole. Three numbers, three different questions; the calculator shows all of them because headlines and homework problems slide between them without warning.
The distinction also explains a deliberate blank. Mixed signs can drive the share of the total below zero, or cancel the total to zero, and in either case the calculator suppresses the share, because a negative percentage of a whole no longer means anything. The ratio and its decimal remain well defined, and the share is shown whenever it comes out at zero or above.
From Euclid to the rule of three
Everything this calculator does was codified remarkably early. Euclid's Elements defines a ratio as "a sort of relation in respect of size between two magnitudes of the same kind" (Book V, Definition 3), and Book V builds a general theory of when two ratios are the same, subtle enough to handle magnitudes, like a square's side and its diagonal, that share no common measure. Ancient commentators attributed that theory to Eudoxus of Cnidus (c. 408–355 BC); the attribution rests on an anonymous marginal note reporting that "some say" the book was his discovery. The repeated-remainder procedure described above is Euclid's algorithm, set out in Book VII, Proposition 2, and Proposition 19 of the same book proves that four numbers are proportional exactly when the product of the extremes equals the product of the means, which is why cross-multiplication works.
The missing-value problem has a more commercial history. The Chinese Nine Chapters on the Mathematical Art, compiled somewhere between roughly 200 BC and 50 AD, devotes a chapter to grain-exchange problems solved this way. Indian mathematicians called the method trairāśika, "three terms"; it appears in the Bakhshali manuscript and the Aryabhatiya, and D. E. Smith's History of Mathematics records the name rule of three in Brahmagupta (c. 628) and Bhaskara (c. 1150). Fibonacci's Liber abaci (1202, revised 1228), the book that brought Hindu-Arabic numerals to Europe, then gave the technique wide European circulation; Britannica notes that most of the work is devoted to proportion, "represented by such popular medieval techniques as the Rule of Three and the Rule of Five". Merchants prized the rule enough to rename it: Robert Recorde (c. 1542) calls it "the rule of Proportions, whiche for his excellency is called the Golden rule", and the seventeenth-century arithmetician Hodder explains that "as Gold transcends all other mettals, so doth this Rule all others in Arithmetick", both quotations preserved through Smith. For centuries it marked the summit of an ordinary education. In the autobiographical sketch written for Jesse W. Fell on December 20, 1859, Abraham Lincoln said of his schooling, "Still somehow, I could read, write, and cipher to the Rule of Three; but that was all" — the punctuation varies slightly between transcriptions, the assessment does not.
Reading and using the result
A ratio compares like with like, so both sides need the same unit before they are entered: 1 minute against 4 hours is not 1:4 but 1:240 once both are in minutes. Order matters just as much, since 2:3 and 3:2 describe opposite situations, with decimals 0.6667 and 1.5 respectively. Two ratios are equivalent exactly when they reduce to the same lowest terms, which makes simplify mode the fastest test of whether two mixtures or two gear pairings are really the same: reduce both and compare. Scaling preserves the ratio but not the total, so doubling a 12:18 blend doubles the combined quantity from 30 to 60. A factor between 0 and 1 shrinks instead, turning 12:18 into 6:9 at 0.5, and a negative factor flips the sign of both sides while leaving their relationship intact.
Assumptions and conventions
Inputs are accepted between -1,000,000,000 and 1,000,000,000, endpoints included; anything beyond returns an error rather than a silently rounded answer. In simplify mode decimal sides are read to at most nine decimal places, and the whole numbers produced by clearing them must stay inside JavaScript's exact integer range of 9,007,199,254,740,991; values too precise for that are refused rather than reduced inexactly. Signs stay on their own side, so -12:18 simplifies to -2:3 and a ratio with two negative sides keeps both signs. A second value of zero is rejected in simplify mode, since a ratio against nothing cannot be reduced, while in scale mode it is allowed and only the decimal field is left blank. A first value of zero is rejected in solve mode because the cross-multiplication would divide by zero, and a scale factor of zero is rejected because it collapses every ratio to 0:0. Computed results are refused beyond a magnitude of 1,000,000,000,000,000 so the display never garbles. The result line and the decimal output are shown to at most four decimal places, with the full-precision values kept behind the rounding.
Frequently asked questions
How do you simplify a ratio to its lowest terms?
Divide both sides by their greatest common divisor. For 12:18 the greatest common divisor is 6, so the ratio reduces to 2:3. If either side has decimals, multiply both by the same power of ten until they are whole numbers first: 2.5:7.5 becomes 25:75, which reduces to 1:3.
How do you find the missing value in a proportion?
Cross-multiply. If a:b equals c:x, then a times x equals b times c, so x is b times c divided by a. For 12:18 = 10:x that gives x = 18 times 10 divided by 12, which is 15. The one case with no answer is a first value of zero, because it would mean dividing by zero.
Is a ratio the same as a fraction?
Not quite. A ratio usually compares one part with another part, while a fraction names a part of a whole. In the ratio 2:3 the first part is 2/5 of the total, which is 40 percent, not 2/3. The quotient 2 divided by 3, about 0.6667, is a third number again: the size of the first part per unit of the second.
How do you convert a ratio to a percentage?
Decide which whole you mean. To express the first part as a share of the total, divide it by the sum of both parts: for 12:18 that is 12 divided by 30, which is 0.4 or 40 percent. To express the first part relative to the second instead, divide 12 by 18, which is about 66.67 percent.
How do you scale a ratio without changing it?
Multiply both sides by the same nonzero number. 12:18 scaled by 2.5 becomes 30:45, and both ratios divide out to the same decimal, about 0.6667, so they are equivalent. Multiplying by zero is the one move that destroys a ratio, since 0:0 no longer compares anything.
Can a ratio contain decimal numbers?
Yes. A ratio like 2.5:7.5 is legitimate, and it can always be rewritten with whole numbers by multiplying both sides by a power of ten. This calculator reads up to nine decimal places, multiplies both sides up to whole numbers, and then reduces by the greatest common divisor, so 2.5:7.5 simplifies to 1:3.