HomeEveryday Life › Unit Price Comparison Calculator

Unit Price Comparison Calculator

Divides each price by its quantity to get the price per unit, tells which of two options is cheaper per unit and by what percentage.

When to use

You are comparing two package sizes or brands of the same product (e.g. 500 g for 3.49 vs 1 kg for 5.99) and want the better value per unit.

Do not use when: The two quantities are in different units (convert them to the same unit first, e.g. with mass or volume), or you need a discount on a single price (use discount).

Formula

unit_price = price / quantity; savings_percent = (max(unit_price_a, unit_price_b) − min(unit_price_a, unit_price_b)) / max(unit_price_a, unit_price_b) × 100

Inputs

ParameterTypeUnitRequiredDescription
price_anumberyesTotal price of option A. Range: ≥ 0, ≤ 100000000
quantity_anumberyesQuantity in option A (grams, kilograms, litres, pieces …). Range: > 0, ≤ 1000000000
price_bnumberyesTotal price of option B. Range: ≥ 0, ≤ 100000000
quantity_bnumberyesQuantity in option B, in the same unit as quantity_a. Range: > 0, ≤ 1000000000

Outputs

OutputTypeUnitDescription
unit_price_anumberprice_a / quantity_a, per one unit of quantity.
unit_price_bnumberprice_b / quantity_b.
cheaper_optionstring'Option A', 'Option B' or 'Same unit price'.
savings_percentnumber%How much lower the cheaper unit price is, relative to the more expensive one.
unit_price_differencenumber|unit_price_a − unit_price_b|.

Example

0.5 kg for 3.49 vs 1 kg for 5.99: {"price_a":3.49,"quantity_a":0.5,"price_b":5.99,"quantity_b":1}{"unit_price_a":6.98,"unit_price_b":5.99,"cheaper_option":"Option B","savings_percent":14.18,"unit_price_difference":0.99}

12 eggs for 2.00 vs 18 eggs for 3.30: {"price_a":2,"quantity_a":12,"price_b":3.3,"quantity_b":18}{"unit_price_a":0.1667,"unit_price_b":0.1833,"cheaper_option":"Option A","savings_percent":9.09,"unit_price_difference":0.0167}

GET https://tttkmbb.com/api/v1/calculate/unit-price?price_a=3.49&quantity_a=0.5&price_b=5.99&quantity_b=1

Machine access

Sources

FAQ

Which unit should I use for the quantities?

Any unit, as long as both options use the same one; unit prices are then per that unit. Using kg or L instead of g or ml gives more readable unit prices.

Is the larger package always cheaper per unit?

No. Promotions on small sizes frequently undercut bulk packs, which is exactly what this comparison reveals.

Related calculators