The most common reason Shopify shipping rates are inaccurate is not the carrier — it is the box. If the package dimensions fed to USPS, UPS, or FedEx are wrong, the rate will be wrong. Bin packing is the algorithm that solves this by calculating the actual optimal box for every specific order. Here is how it works and why it matters for your shipping costs.
What Bin Packing Is
Bin packing is a classic computer science problem: given a set of items with known dimensions and a set of containers (bins) with known dimensions, find the arrangement that fits all items into the fewest bins with the least wasted space. In the context of shipping, the items are the products in a customer's cart and the bins are your box library. The algorithm tests combinations of boxes against the items in the order and finds the configuration that minimizes package volume — which directly reduces dimensional weight and carrier cost.
Why the Box You Choose Changes the Rate
Carriers calculate rates using whichever is greater: actual package weight or dimensional weight. Dimensional weight = (length × width × height) ÷ 139 for UPS and FedEx. If you ship a 3 lb product in a 14×12×10 box, the dimensional weight is (14×12×10)/139 = 12.1 lbs. You pay for 12.1 lbs. If PackOS's bin-packing algorithm determines that the product fits in a 10×8×6 box, the dimensional weight drops to (10×8×6)/139 = 3.5 lbs. You pay for 3.5 lbs. The rate difference between 12.1 lb and 3.5 lb on a Priority Mail Express shipment can be $8–15. At volume, choosing the right box is one of the highest-leverage cost optimizations available.
How PackOS Runs Bin Packing at Checkout
PackOS stores the length, width, height, and weight of each product in your Shopify catalog. When a customer builds a cart and reaches the shipping step, PackOS runs a bin-packing calculation against all the items in the cart and all the box sizes in your configured box library. The result is a PackResult: the optimal set of boxes for that specific order, with total weight and dimensions per box. Those dimensions are then passed to USPS, UPS, and FedEx via EasyPost to fetch accurate carrier rates. The entire calculation happens in real time — the customer sees accurate rates before they pay, not an estimate based on order weight alone.
Multi-Box Orders — When One Box Is Not Enough
For large orders or orders with items of incompatible dimensions, bin packing may determine that more than one box is needed. PackOS handles multi-box shipments natively: it calculates the optimal split, fetches rates for each box independently, and sums the total for each carrier service across all boxes. The customer sees a single rate per carrier — for example, '$14.72 UPS Ground' — that reflects the actual total cost of two boxes, not a guess based on combined order weight. This is where flat-rate shipping tables fail most visibly: a two-box order is often priced the same as a single-box order of similar weight, leading to significant undercharging.
Setting Up Your Box Library for Accurate Results
The quality of bin-packing results depends directly on the accuracy of your box library and your product dimensions. Start by measuring all the boxes you actually ship — length, width, height, and the box's own weight. Enter these in PackOS under Box Library. Then ensure product dimensions are entered for your full catalog: each product's length, width, height, and weight in the PackOS Labels portal. Products without dimensions use a configurable default — but the more products have exact dimensions, the more accurate the bin-packing calculation becomes. For merchants with large catalogs, PackOS supports bulk dimension import via CSV.
