To calculate unit price from total cost and quantity, divide the total cost by the quantity: unit price = total cost ÷ quantity. A $6.40 carton holding 64 fluid ounces works out to $0.10 per fluid ounce, while a $4.00 carton holding 32 fluid ounces comes to $0.125 per ounce. The only real condition is that the quantity and the unit you want must match before you divide, and that both packages be measured in the same unit before you compare.
Divide Total Cost by Quantity to Get Cost per Single Unit
The arithmetic is one division, and everything else in this guide protects that division from bad inputs. Shopify's pricing guide, updated November 10, 2026, states the formula plainly: unit price equals total price divided by total quantity. A 20-unit order costing $360 lands at $18 per unit. Nothing about the calculation depends on what the product is, which is why the same operation handles pencils, detergent, and freight pallets.
Keep the raw result in decimals until the final step. $4.00 ÷ 32 ounces is 0.125, and rounding to 13 cents mid-calculation introduces error when you then compare four or five packages. Convert to cents only when you present the number.
Direction matters in business contexts. In retail, unit price is the selling price per standard measure and it faces the customer. Unit cost is what production costs you per unit made, and a small-batch manufacturer guide from Stocksmith draws the line clearly: unit cost is total production cost divided by units made, and your selling price has to clear it before any profit appears. Both use division, and confusing them turns a margin into a loss.
Test your inputs before trusting the output. If doubling the quantity doesn't roughly halve the unit price, you divided by the wrong figure. That one-second sanity check catches most errors.
Match Decimal Places and Currency Formatting Before Dividing
Money formatting causes quiet errors. Adult basic education materials from OpenTextBC put the rule first: make sure all prices use the same style, dollars or cents, never one of each. Dividing $4.20 by a quantity while a competitor's price sits at 330¢ produces a comparison between 4.2 and 330, and the "winner" is nonsense.
Pick a working format and lock it. Dollars with two decimals suit most retail math. Cents suit tight comparisons across small items, where $0.02 per gram reads more clearly as 2¢ per gram. The format you choose should survive to the last step, because a mixed-format table is where honest calculations go wrong.
Carry enough decimal places. A unit price of $0.0063 per sheet needs four decimals to separate two reams of copy paper. Two decimals would flatten both to $0.01 and hide the difference entirely. Round only in the final presentation, and round all compared items to the same precision.
Most jurisdictions don't mandate shelf-level unit pricing at all. The National Institute of Standards and Technology's guide to retail pricing laws identifies mandatory unit-pricing provisions in states including Connecticut and New York, with voluntary provisions elsewhere. That means the per-unit figure you see on a label isn't guaranteed, and your own division is the reliable check.
Convert Both Quantities to the Same Unit Before Comparing Sizes
The formula breaks the moment quantities arrive in different units. Inch Calculator's unit price tool flags the case directly: if the total quantity is in pounds but you want the unit price in ounces, convert the quantity first, then divide. You cannot compare $8.99 per pound against $0.52 per ounce without moving one figure across the bridge.
The bridge is multiplication. There are 16 ounces in a pound and 1,000 grams in a kilogram, so a 2.5-pound bag holding 40 ounces at $8.99 works out to $0.225 per ounce, or $3.60 per pound. The 24-ounce box at $5.28 is $0.22 per ounce. The box wins, but by a third of a cent per ounce, which is why the precision rule from the previous section matters.
Watch for metric-imperial pairs on the same shelf. Detergent sold at 1.5 kilograms next to a 48-ounce bottle requires a full conversion, and 48 ounces is about 1.36 kilograms, so the kilogram package is larger. Convert everything to the unit printed on the shelf tag before comparing, because that's the unit the store chose for its own label.
Volume has its own trap. Fluid ounces measure volume and ounces measure weight, and for water they coincide while for honey they don't. If both packages state the same unit family, divide directly. If one is fluid and one is weight, find a common denominator like price per 100 grams only if the product density is comparable, otherwise compare within each family separately.
Run a Shrinkflation Check by Comparing Cost per Unit Over Time
Package sizes shrink while shelf prices hold, and division exposes it. CivicScience research published in April 2025 found that 56 percent of Americans surveyed said they'd noticed grocery packaging getting smaller without a matching price drop. A unit-price calculation is the only consumer tool that catches this automatically, because the total price looks stable while the denominator quietly falls.
Keep a note of past unit prices. Before the change, 16 ounces at $3.20 was $0.20 per ounce. After the change, 14 ounces at $3.20 is $0.2286 per ounce, a 14.3 percent increase on the same shelf price. Neither number appears anywhere on the tag. You can verify both values arithmetically from the package weights alone.
Apply the same check to your own purchasing records. A supplier contract that holds the invoice total while trimming case counts is delivering the same trick at business scale. Divide the invoice by the case count every quarter, and the trend line tells you what the contract renewal conversation should be about. The formula hasn't changed; the inputs have.
If the store didn't restate its shelf label, your old receipt is the reference point. Photograph shelf tags for staples you buy weekly, and compare once a month. The shrinkflation signal is flat price plus rising unit price.
Compare Packages Cost per Unit in One Table and Let the Numbers Decide
A side-by-side table settles multi-package decisions faster than prose. Prices and quantities below are illustrative arithmetic examples built for the comparison; treat them as the math, not as current shelf prices. Run the same arithmetic on any shelf you're standing in.
| Package | Total cost | Quantity | Unit price | Cost per standard unit |
|---|---|---|---|---|
| 32 fl oz carton | $4.00 | 32 fl oz | $0.125/fl oz | $16.00/gallon |
| 64 fl oz carton | $6.40 | 64 fl oz | $0.10/fl oz | $12.80/gallon |
| 20-count pack | $18.00 | 20 units | $0.90/unit | $90.00/100 units |
| 6-count pack | $2.70 | 6 units | $0.45/unit | $45.00/100 units |
The last column is the why of the whole exercise. Normalizing to a gallon and to 100 units puts packages on a common ruler, and the 64-ounce carton saves 20 percent per fluid ounce over the 32-ounce one. The 6-count pack at $0.45 per unit beats the 20-count pack at $0.90 per unit by half, which reverses the intuition that bulk always wins.
The verdict rule: buy the lowest unit price if the product stores and you'll use it. The 64-ounce carton only wins if the extra 32 ounces get consumed before spoilage. For perishables, the total cost of waste belongs in the comparison, and a larger package with a thrown-away half is the more expensive option.
Handle the Failure Cases That Break the Division
Four failure modes account for most wrong unit-price answers, and each has a named fix. The first is a zero or blank quantity, which makes the division undefined. Check that the quantity field holds a real number before dividing, and note that "each" packages should carry a quantity of 1.
The second is a mixed measurement system across packages. The fix is the conversion step described earlier, applied to every option, not just the outliers. If a table row still shows different unit families after conversion, remove it rather than compare across families.
The third is a multi-pack where the count and the size disagree. A "12-pack of 8-ounce cans" has a quantity of 96 ounces for volume comparisons or 12 for per-can comparisons, and both answers are valid for different questions. Decide which question you're asking first.
The fourth is a promotional "buy one, get one" offer. The unit price of the deal is total deal cost divided by total units received, not the pre-promotion divide-by-one. A $4.00 unit at BOGO is $2.00 per unit across two items, and that comparison must sit against a competitor's regular price, not their promo price.
Apply the Math to Business Costs and Retail Shelf Labels
Businesses run the same calculation in two directions. Toward the shelf, the retail unit price tells customers what they'll pay per standard measure. A Shopify merchant help page shows the mechanics: a $30 product weighing 600 grams displayed per kilogram yields $50.00 per kilogram, computed as $30 ÷ 600 grams × 1,000. The base-measure step is the only difference from the consumer calculation.
Toward the books, the buying unit price is what you paid per unit purchased, and it drives margin. A $360 order for 20 units is $18 per unit bought, and if the retail unit price is $24, the gross margin per unit is $6 before overheads. The formula doesn't distinguish these; only the input price does.
Retail labels may not exist. If your state falls under the voluntary provisions NIST documents, a shelf tag may show only the total price for the package size, so customers have to divide. That's the argument for keeping the formula on your phone's notes app or a bookmark, especially for multi-buy aisles.
The cost-of-goods conversation with a supplier sharpens when you quote unit prices at the table. "Your price per case is $18, but it was $18 for 24 units last year and it's $18 for 20 now" is a sentence backed by the formula. The arithmetic is your negotiating leverage.
Check the Result Against a Threshold Instead of Chasing the Cheapest
Cheapest per unit isn't always the right call, and a threshold check keeps a good calculation from becoming a bad decision. The comparison from the earlier table sets that threshold in concrete terms: the 64-ounce carton beats the 32-ounce one by 2.5 cents per fluid ounce, and the dollar gap on a single purchase is $0.80 across the pair. For a weekly staple, that compounds; for a one-off trial purchase, it may not justify the volume.
Quality, spoilage, storage space, and transport are the four conditions that can override a unit-price verdict. A bulk bag of flour has a low unit price and a finite shelf life. If your weekly flour use is 1 kilogram, a 10-kilogram bag at 30 percent less per kilogram is only a win if the last few kilograms get used. Otherwise the genuine cost per kilogram is the bag price divided by the kilograms you actually consume.
For repeatable purchases, keep a running comparison at a fixed cadence. Monthly comparisons catch shrinkflation and seasonal discount patterns. The formula stays the same; the inputs refresh. That is the full method in one sentence.
FAQ
What is the formula to calculate unit price?
Unit price equals total cost divided by quantity, and Shopify's pricing guide states that exact form. The result is cost per one unit of whatever quantity you entered. If you want cost per 100 units or per kilogram, divide the quantity by that base value first, then divide the cost. The division runs the same way regardless of product type.
Why did my unit price come out as a fraction of a cent?
Small, cheap units produce tiny unit prices, and a box of 500 paper clips at $3.15 works out to $0.0063 per clip. Express it as a fraction of a cent or multiply by 100 to get cost per 100 clips ($0.63). Never round to $0.01, because that's $0.0063 and $0.01 is 37 percent of the true figure. Keep enough decimals until the final display.
Is shrinkflation legal, and how do I spot it?
UK trading standards treat shrinking package sizes without flagging them as potentially misleading, and the US regulatory picture varies by state under NIST's unit-pricing provisions. The practical spotter is the unit price: track the per-ounce cost for staples you buy weekly and compare against a note from last month. A flat shelf price with a smaller package will show a rising per-ounce figure, and that's the signal.
Should I always buy the lower unit price?
Not if the product spoils before you use the extra volume. The lower unit price is the better value only when the full quantity gets consumed, and for perishables the waste cost belongs in the comparison. Use a threshold rule: buy the lower unit price when the shelf life of the package exceeds your typical consumption window. Otherwise the smaller package wins on true cost.
How is unit price different from unit cost?
Unit price is what one unit sells for or costs you to buy, and the per-shelf calculation divides the total price by the quantity. Unit cost is what it costs you to manufacture one unit, computed as total production cost divided by units made. A small-batch manufacturing guide draws this distinction explicitly, and a selling price has to clear unit cost before any profit appears.
Do stores have to display unit prices?
Not everywhere. The National Institute of Standards and Technology identifies mandatory unit-pricing rules in states including Connecticut and New York, and voluntary provisions elsewhere. If your store is in a voluntary state and the shelf tag shows only the total price, do the division yourself. Package size and total price appear on every tag under federal labeling rules, so the calculation is always possible.
What if the two packages use different units?
Convert both quantities to a single unit before dividing, which is the first step described by Inch Calculator's unit price tool. Twelve ounces and one pound adjacent on a shelf requires converting one figure so both sit in the same family. After conversion, divide as normal and compare the two per-unit results. Never compare a per-pound number to a per-ounce number directly.
How do I calculate unit price on a multi-pack or a promotion?
For a multi-pack, multiply the count by the per-item size to get the comparison quantity, then divide the total cost. For a buy-one-get-one offer, count the total units received and divide the full deal cost by that figure, so a $4.00 item at BOGO is $2.00 per item across two. Compare that to a competitor's regular price, not their promotional price, for a fair contest.