Method
How Box Optimizer chooses your boxes
A Rust engine, compiled to WebAssembly, runs in your browser. It tests every order against every candidate box and chooses the set of K sizes with the lowest total shipping + box cost.
The pipeline
- Step 1
Your CSVs
Products, orders, current boxes
- Step 2
Clean & group
Identical orders become one order type with a count
- Step 3
Candidate boxes
170 standard stock sizes, or a tight custom size per order type
- Step 4
Fit check
3D packer: does this order fit this box?
- Step 5
Cost
DIM weight, billable weight, rate, box price
- Step 6
Choose K boxes
Greedy + swap search over all candidates
- Step 7
Report
Before/after, buying list, 3D view
Choosing K boxes, in plain words
Think of each candidate box as a shop you could open, and each order type as a customer who goes to the cheapest open shop that fits them. Opening K shops so that the total cost for all customers is as small as possible is a classic problem called the p-median (or facility location) problem.
- Cost of an order in a box = shipping price for its billable weight + the box price + void fill. Billable weight is the larger of the real weight (items + cardboard) and the DIM weight (box volume ÷ divisor), rounded up to a whole pound. Big boxes cost more even when they are light. Void fill is the material (air pillows, paper) needed for the space inside the padding that the products leave empty, priced at $0.50 per ft³ by default.
- Greedy start: add the box that lowers the total cost the most, K times.
- Swap search: try replacing each chosen box with each other candidate and keep any swap that lowers the cost, until nothing improves (at most 50 rounds). We also start from the best K−1 solution and from the best single boxes, so adding a box size never makes the result worse.
- Every order that fits some candidate must get a box: leaving it out costs a large penalty. Orders that fit no single box are listed as needing 2+ boxes.
- The baseline puts each order in the cheapest of your current boxes, which is what box-picker apps do. So the savings come on top of them.
Why we measure air, not only empty space %
- Padding counts as empty space. Every box keeps 0.5 in of clearance on each side for protection. That space holds no product, so it is part of the empty space, even for a perfect fit. A small candle in a snug box can still be more than half empty.
- Empty space % is relative. It is the same for a tiny box and a huge box with the same proportions, and it says nothing about how much is shipped. Small products make it look high even when there is little to gain.
- Air volume is absolute. Air shipped per year (box volume minus product volume, in ft³) is what fills trucks, what DIM pricing charges for, and what you buy void fill for. That is why the results lead with air shipped and void fill needed, and show empty space % as a secondary number.
- Void fill counts only the space inside the padding (usable volume minus product volume): the padding itself is the protective clearance.
Does it fit? The 3D packer
- Every box loses 0.5 in of padding on each side (adjustable) for protective fill.
- One item: exact. It fits when its sorted dimensions are each no larger than the box's sorted inside dimensions (any rotation allowed).
- Several items: the extreme-point heuristic (Crainic, Perboli & Tadei, 2008, simplified). Items go in largest first; each is placed at the lowest, then front-most, then left-most free corner point, trying all six rotations. A second pass orders items by longest side.
- It is conservative: it may say “no” for an order that could be squeezed in by hand, but every “yes” comes with a real, overlap-free placement (checked by property tests). This is the placement you see in the 3D viewer.
Validation against brute force
On a reduced version of the sample store (the 25 most relevant candidate boxes), we try every combination of 2 and 3 boxes and compare the true optimum with our method.
Assumptions
| Constant | Value | Source / status |
|---|---|---|
| DIM divisor, UPS/FedEx-style | 139 in³/lb | Assumption: verify with carrier |
| DIM divisor, USPS-style | 166 in³/lb, only above 1728 in³ (1 ft³) | Assumption: verify with carrier |
| Billable weight | max(actual, DIM), rounded up to whole lb | Common carrier rule |
| Rate table | $8.50 at 1 lb + $0.95 per extra lb (to 70 lb, extended beyond) | Illustrative: replace with your rates |
| Board weight (single wall) | 0.13 lb/ft² (≈ 0.63 kg/m²) | Assumption: verify with supplier |
| Stock box price | $0.20 + $0.0015 × surface area (in²) | Estimate: compare with a price list |
| Void fill cost | $0.50 per ft³ of void (usable volume − item volume); editable | Assumption: verify with your fill supplier |
| Custom box price | stock formula × 1.25 | Estimate; minimum order quantities apply |
| Padding per side | 0.5 in (adjustable 0–2 in) | Default: adjust to your packing |
| Order size cap | 40 items per order | Larger orders are flagged |
| Custom candidates | up to 300 sizes, rounded up to 0.5 in | Engine limit |
| Annualization | 365 / days spanned by order dates; no dates = one year | Labeled in results |
Privacy
Runs in your browser. Your CSV files are read and processed on your own computer inside a Web Worker; no order data is uploaded, stored or sent anywhere.
Try it on your data