Math Runs locally Ready to use Built-in examples No tracking

Ratio Calculator

Solve for the missing term in a proportion, reduce a ratio to simplest integer form, or convert a ratio to a percentage share.

Ratios turn up wherever proportions matter more than amounts: mixing a solution 1 to 800, holding a water-to-flour ratio while the batch size changes, or keeping an aspect ratio while an image is resized. Three modes cover the common directions — completing the missing term, reducing a ratio to its simplest integer form, and working out what share one part is of the whole.

Reducing accepts decimals and fractions (0.5 : 1.25 becomes 2 : 5), and completing a proportion uses the cross-product rule (A·x = B·C). Watch the last mode: "what share is A of A + B" is a share of the whole (in 3:7, A is 30%), which is not the same as "what percentage is A of B" (3/7 ≈ 42.9%). Mixing the two is a common reporting error, so the label states which one you are getting.

How to use

  1. Choose a mode: complete the proportion, reduce a ratio, or find a share.
  2. Enter the values (decimals and fractions are accepted).
  3. Read the result — the mode in use is labelled so the basis is clear.
  4. For a ratio between two parts rather than a share of the whole, use one of the first two modes.

How it works

Solve for the fourth term

Fourth term: in a proportion, the product of the extremes equals the product of the means. From A:B = C:x, x = C×B÷A. For a rice-to-water ratio of 1:1.5, two cups of rice need three cups of water.

Simplify a ratio

Simplifying: 8:12 reduces to 2:3 by dividing both parts by the GCD 4. Decimal ratios work too — 1.5:2.5 multiplies both by 10 into 15:25, then simplifies to 3:5.

Compute a share

Share: the percentage A represents of A+B. In a 3:7 mixture, A makes up 3÷10 = 30%.

Code example

JavaScript Three modes implemented

const solveX = (a, b, c) => b * c / a;          // A:B = C:x

function simplifyRatio(a, b) {                  // reduce to the smallest integer ratio
  const gcd = (x, y) => y ? gcd(y, x % y) : x;
  let x = a, y = b, k = 1;
  while (!Number.isInteger(x) || !Number.isInteger(y)) { x *= 10; y *= 10; }
  const g = gcd(Math.abs(x), Math.abs(y)) || 1;
  return (x / g) + ":" + (y / g);
}
const sharePct = (a, b) => a / (a + b) * 100;   // A as a share of (A+B)

solveX(2, 3, 4);        // 6
simplifyRatio(0.5, 1.25);   // "2:5"

Python The same three modes in Python

from fractions import Fraction

solve_x = lambda a, b, c: b * c / a
share_pct = lambda a, b: a / (a + b) * 100

def simplify_ratio(a, b):
    x, y = Fraction(str(a)), Fraction(str(b))
    return f"{x / y.numerator * y.denominator.numerator:.0f}"  # simplified case

# A more robust reduction:
def ratio(a, b):
    x, y = Fraction(str(a)), Fraction(str(b))
    k = x / y
    return f"1:{k}" if k < 1 else f"{1 / k}:1"

ratio(0.5, 1.25)   # "2:5"

FAQ

What is the fundamental property of a proportion?

In A:B = C:D, the product of the extremes (A×D) equals the product of the means (B×C). This is what justifies solving for the fourth term: D = B×C÷A.

Is a simplified ratio more useful than the original?

Simplifying changes only the digits, never the ratio. 2:3 and 8:12 express exactly the same relationship, but 2:3 makes the multiple relationship obvious and is easier to scale mentally when mixing ingredients.

Is "share" the same thing as a ratio?

No. A ratio is one number divided by another (3:7 ≈ 0.43); a share is the percentage a part makes of the whole (3 is 30% of 3+7). The same "3:7" yields different numbers depending on the framing.

Ratio vs. proportion — what's the difference?

A ratio is a single relation "a : b"; a proportion is an equation saying two ratios are equal: "a : b = c : d". The key property — means product equals extremes product (ad = bc) — lets you solve for the fourth term from three knowns, which is exactly how this tool's "solve x" mode works.

How do I find the fourth term of a proportion?

From a : b = c : x, x = b × c ÷ a. For 2 : 3 = 4 : x, x = 3 × 4 ÷ 2 = 6. This is "cross multiplication": substitute the three knowns in their means/extremes positions carefully — misalignment is the classic mistake.

How do I scale a recipe from a ratio?

Add the ratio terms for total parts, divide the total quantity by that to get one part, then multiply per component. Concrete at 1 : 2 : 3 totaling 600 kg has 6 parts of 100 kg each: cement 100, sand 200, gravel 300.

Why is the share of 3 : 7 equal to 30%?

Share = part ÷ total × 100 = 3 ÷ (3 + 7) × 100% = 30%. The ratio "3 to 7" compares two numbers against each other; the share "3 is 30% of 10" compares a part against a 100% total. Different reference frames — don't mix them.