Unit Price Comparison

Calculate using the labelled inputs: Unit Price Comparison.

A price per common unit
5
B price per common unit
4
B price reduction relative to A (%)
20
Lower unit price
Package B
Savings relative to the higher unit price (%)
20

Choose the same quantity basis and currency for both packages. oz is mass; US fl oz is volume. This selector labels the common basis; it does not convert quantities between dimensions.

Calculation and assumptions

u_A=P_A/Q_A; u_B=P_B/Q_B; B_vs_A=100(u_A−u_B)/u_A; saving=100·|u_A−u_B|/max(u_A,u_B).

Use the same currency and quantity unit for both packages. Prices have at most two decimals; quantities are positive. Either package may be free. Exact decimal fractions determine the winner before display rounding. B reduction relative to A is signed; negative means B costs more per unit and zero A gives a dash. Savings relative to the higher price are nonnegative; equal positive unit prices give zero, two free packages give a dash. Displayed unit prices retain up to ten significant digits. No taxes or market prices supplied.

Choose the same quantity basis and currency for both packages. oz is mass; US fl oz is volume. This selector labels the common basis; it does not convert quantities between dimensions.

Frequently asked questions

How is the result calculated?

u_A=P_A/Q_A; u_B=P_B/Q_B; B_vs_A=100(u_A−u_B)/u_A; saving=100·|u_A−u_B|/max(u_A,u_B).

What assumptions apply?

Use the same currency and quantity unit for both packages. Prices have at most two decimals; quantities are positive. Either package may be free. Exact decimal fractions determine the winner before display rounding. B reduction relative to A is signed; negative means B costs more per unit and zero A gives a dash. Savings relative to the higher price are nonnegative; equal positive unit prices give zero, two free packages give a dash. Displayed unit prices retain up to ten significant digits. No taxes or market prices supplied.

How precise are the results?

Monetary totals use two decimal places, with exact halves rounded away from zero at the steps described. Ratios and other numbers show up to ten significant digits. Display precision does not improve input accuracy.

How we verified this calculator

The calculator is checked against 6 reference cases computed independently of its code. Last passed: .

# Inputs Expected result
1
Common quantity basis = Count — items
Package A price = 10
Package A quantity in the common unit = 2
Package B price = 12
Package B quantity in the common unit = 3
A price per common unit: 5
B price per common unit: 4
B price reduction relative to A (%): 20
Savings relative to the higher unit price (%): 20
2
Common quantity basis = Count — items
Package A price = 10
Package A quantity in the common unit = 2
Package B price = 20
Package B quantity in the common unit = 4
A price per common unit: 5
B price per common unit: 5
B price reduction relative to A (%): 0
Savings relative to the higher unit price (%): 0
3
Common quantity basis = Count — items
Package A price = 0
Package A quantity in the common unit = 2
Package B price = 12
Package B quantity in the common unit = 3
A price per common unit: 0
B price per common unit: 4
Savings relative to the higher unit price (%): 100
4
Common quantity basis = Count — items
Package A price = 10
Package A quantity in the common unit = 2
Package B price = 0
Package B quantity in the common unit = 3
A price per common unit: 5
B price per common unit: 0
B price reduction relative to A (%): 100
Savings relative to the higher unit price (%): 100
5
Common quantity basis = Count — items
Package A price = 0
Package A quantity in the common unit = 2
Package B price = 0
Package B quantity in the common unit = 3
A price per common unit: 0
B price per common unit: 0
6
Common quantity basis = Mass — oz
Package A price = 10
Package A quantity in the common unit = 2
Package B price = 12
Package B quantity in the common unit = 3
A price per common unit: 5
B price per common unit: 4
B price reduction relative to A (%): 20
Savings relative to the higher unit price (%): 20

How we test our calculators →

Also try:

Back to category →