Home › Everyday 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
| Parameter | Type | Unit | Required | Description |
|---|---|---|---|---|
price_a | number | yes | Total price of option A. Range: ≥ 0, ≤ 100000000 | |
quantity_a | number | yes | Quantity in option A (grams, kilograms, litres, pieces …). Range: > 0, ≤ 1000000000 | |
price_b | number | yes | Total price of option B. Range: ≥ 0, ≤ 100000000 | |
quantity_b | number | yes | Quantity in option B, in the same unit as quantity_a. Range: > 0, ≤ 1000000000 |
Outputs
| Output | Type | Unit | Description |
|---|---|---|---|
unit_price_a | number | price_a / quantity_a, per one unit of quantity. | |
unit_price_b | number | price_b / quantity_b. | |
cheaper_option | string | 'Option A', 'Option B' or 'Same unit price'. | |
savings_percent | number | % | How much lower the cheaper unit price is, relative to the more expensive one. |
unit_price_difference | number | |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
- API:
GET https://tttkmbb.com/api/v1/calculate/unit-price(query parameters) orPOSTwith a JSON body{"inputs": {...}} - Schema: https://tttkmbb.com/api/v1/calculators/unit-price · Markdown: https://tttkmbb.com/everyday/unit-price.md · JSON definition: https://tttkmbb.com/everyday/unit-price.json
- MCP: server
https://tttkmbb.com/mcp, toolrun_calculator with calculator_id="unit-price" - OpenAPI operationId:
calculate_unit_price - Freshness:
static. Authentication: none. Rate limit: fair use (see rate limits).
Sources
- Unit price (Wikipedia) (reference)
- EU Directive 98/6/EC on the indication of unit prices (standard)
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
- Discount Calculator — Apply a percentage discount to a price.
- Percentage Change Calculator — Percentage difference between two prices.