Ratio Calculator
Simplify any ratio to lowest terms and scale it to a total amount. Converts ratios to decimals and percentages with step-by-step arithmetic.
Ratio Calculator
Background.
A ratio calculator simplifies a pair of numbers to their lowest terms and optionally scales them to a specified total. Ratios are one of the oldest mathematical concepts, appearing in Euclid's Elements around 300 BCE as a fundamental tool for comparing magnitudes. Today they are used in cooking to scale recipes, in engineering to mix compounds, in finance to compare debt to equity, and in education to teach proportional reasoning. The calculator automates the arithmetic that would otherwise require manual greatest-common-divisor computation and cross-multiplication.
Cooks and bakers search for ratio calculators when adapting recipes for different serving sizes. A cake recipe calling for a 3:2 ratio of flour to sugar can be scaled to feed twenty guests instead of eight by computing the total parts (5) and dividing the desired total weight accordingly. Mechanical engineers use ratios to design gear trains: a 4:1 gear ratio means the driven shaft rotates once for every four rotations of the driving shaft. Financial analysts express leverage as a debt-to-equity ratio, and credit rating agencies use these ratios to assess solvency. The ubiquity of ratios across disciplines makes this one of the most broadly applicable calculators in the mathematics category.
The mathematical foundation of ratio simplification is the greatest common divisor (GCD), also called the greatest common factor. The GCD of two integers is the largest positive integer that divides both without a remainder. Euclid described the algorithm for computing it in Book VII, Proposition 2 of the Elements, using repeated subtraction. The modern version uses the modulo operation: GCD(a, b) = GCD(b, a mod b), continuing until the remainder is zero. This algorithm is efficient, requiring at most five times the number of digits of the smaller number (Lamé's theorem, 1844), and it remains the standard method in computer science.
What is ratio calculator?
A ratio is a comparison of two quantities by division, expressed in the form a:b or a to b. It describes how much of one quantity corresponds to another, without specifying their absolute sizes. Ratios can be simplified by dividing both terms by their greatest common divisor, producing an equivalent ratio in lowest terms. For example, the ratio 8:12 simplifies to 2:3 because GCD(8, 12) = 4. Ratios are used to express part-to-part relationships, whereas fractions express part-to-whole relationships. The ratio 2:3 implies five total parts (2 + 3), so the first quantity is 2/5 of the whole and the second is 3/5. Ratios can involve more than two terms (e.g., 2:3:5 for a three-part mixture), but this calculator handles two-term ratios, which are the most common in practice. Ratios are dimensionless if both quantities have the same unit. If the units differ, the ratio carries units (e.g., miles per hour). The calculator assumes the inputs share a common unit or are pure numbers. Ratios appear in everyday contexts such as mixing paint, diluting cleaning solutions, and adjusting recipe yields. In each case, maintaining the correct proportional relationship ensures consistency and quality regardless of the total batch size.
How to use this calculator.
- Enter the first quantity (Value A) in the input field.
- Enter the second quantity (Value B) in the input field.
- (Optional) Enter a total amount in the Total Parts field to scale the ratio into absolute amounts.
- Review the simplified ratio, displayed in lowest terms (e.g., 2:3).
- Check the decimal and percentage forms for additional context.
- If you entered a total, review the computed amounts for Part A and Part B.
- Use the simplified ratio or scaled amounts in your recipe, engineering spec, or financial analysis.
The formula.
The ratio simplification algorithm rests on the greatest common divisor and the Euclidean algorithm. Given two non-negative integers a and b, the GCD is the largest integer d such that a mod d = 0 and b mod d = 0. The Euclidean algorithm computes this iteratively: replace the larger number with the remainder of dividing the two numbers, and repeat until the remainder is zero. The last non-zero remainder is the GCD. For example, GCD(144, 192): 192 mod 144 = 48; 144 mod 48 = 0; so GCD = 48. Once the GCD is known, the simplified ratio is obtained by dividing each term by it: (a/d) : (b/d). This produces the unique representation in lowest terms because a/d and b/d share no common divisor greater than 1. If d = 1, the ratio is already in lowest terms. The algorithm works for any non-negative integers, including zero: GCD(0, b) = b, so the simplified ratio of 0:b is 0:1. The decimal form is computed as a / b, which expresses the relative magnitude of the first quantity to the second as a single real number. If b = 0, the decimal is undefined and the calculator rejects the input. The percentage form is (a / b) × 100, which expresses the first quantity as a percentage of the second. Scaling the ratio to a total T requires computing the sum of the simplified ratio terms, s = (a/d) + (b/d), then allocating T proportionally: Part A = T × (a/d) / s and Part B = T × (b/d) / s. The allocation preserves the ratio because Part A / Part B = (a/d) / (b/d) = a/b. Dimensional analysis confirms that if T has units of mass, volume, or currency, the parts inherit the same units while the ratio itself remains dimensionless. The time complexity of the Euclidean algorithm is O(log min(a, b)), making it efficient even for very large numbers. Lamé's theorem states that the number of steps required is at most five times the number of decimal digits in the smaller number.
A worked example.
A civil engineer needs to mix concrete with a 150:250 ratio of cement to aggregate by weight. First, the engineer simplifies the ratio using the Euclidean algorithm. GCD(150, 250): 250 mod 150 = 100; 150 mod 100 = 50; 100 mod 50 = 0. The GCD is 50. Dividing both terms by 50 yields a simplified ratio of 3:5. The engineer confirms this by checking that 3/5 = 0.6 and 150/250 = 0.6, so the simplified ratio is equivalent. The total batch size is 800 kilograms. The sum of the simplified ratio parts is 3 + 5 = 8. The cement allocation is 800 × 3/8 = 300 kg. The aggregate allocation is 800 × 5/8 = 500 kg. The engineer verifies that 300 + 500 = 800 kg and that 300:500 = 3:5, confirming the ratio is preserved. The decimal form is 0.6, meaning there is 0.6 kg of cement for every 1 kg of aggregate. The percentage form is 60%, meaning cement constitutes 60% of the aggregate weight. These three representations—ratio, decimal, and percentage—give the engineer flexibility in communicating the mix design to suppliers and inspectors.
Frequently asked questions.
What is the difference between a ratio and a fraction?
Can ratios have more than two terms?
What happens if one of the values is zero?
How does the calculator handle decimal inputs?
Is the ratio 1:2 the same as 2:1?
What is the greatest common divisor and why does it matter?
Can I use this calculator for aspect ratios?
How do ratios apply to financial leverage?
Why does the scaled amount sometimes have decimals?
Are ratios the same as rates?
References& sources.
- [1]Euclid (c. 300 BCE). Elements, Book VII, Propositions 1–3. English translation: Heath, T.L. (1908). The Thirteen Books of Euclid's Elements. Cambridge: Cambridge University Press.
- [2]Hardy, G.H. & Wright, E.M. (2008). An Introduction to the Theory of Numbers, 6th ed. Oxford: Oxford University Press.
- [3]NCTM (2000). Principles and Standards for School Mathematics. Reston, VA: National Council of Teachers of Mathematics.
- [4]Cengel, Y.A. & Boles, M.A. (2015). Thermodynamics: An Engineering Approach, 8th ed. New York: McGraw-Hill.
- [5]Lamon, S.J. (2007). Rational Numbers and Proportional Reasoning: Toward a Theoretical Framework for Research. In F.K. Lester (Ed.), Second Handbook of Research on Mathematics Teaching and Learning (pp. 629–667). Charlotte, NC: Information Age Publishing.
- [6]Lamé, G. (1844). "Note sur la limite du nombre des divisions dans la recherche du plus grand commun diviseur entre deux nombres entiers." Comptes Rendus de l'Académie des Sciences 19:867–870.
In this category
Embed
Quanta Pro
Paid features are coming later.
- All 313 calculators remain free
- No billing is enabled