Ratio Calculator Formula

Understand the math behind the ratio calculator. Each variable explained with a worked example.

Formulas Used

Ratio A:B (as decimal)

ratio_ab = a / b

Ratio B:A

ratio_ba = b / a

A as % of Total

fraction_of_total = (a / (a + b)) * 100

A / (A+B)

part_to_whole = a / (a + b)

Variables

VariableDescriptionDefault
aQuantity A150
bQuantity B200

How It Works

How to Calculate a Ratio

Formula

Ratio A:B = A / B

A ratio compares two quantities by division. The ratio 150:200 simplifies to 3:4 (divide both by 50). Ratios can be expressed as fractions (3/4), decimals (0.75), or percentages. To convert a ratio to parts of a whole, divide each part by the sum.

Worked Example

Compare 150 to 200.

a = 150b = 200
  1. 01Ratio A:B = 150/200 = 0.75 or 3:4
  2. 02Ratio B:A = 200/150 = 1.3333 or 4:3
  3. 03A as fraction of total = 150/(150+200) = 150/350 = 42.86%
  4. 04B as fraction of total = 200/350 = 57.14%

Ready to run the numbers?

Open Ratio Calculator