Bin Packing Optimizer
Pack item sizes into bins of one capacity with First Fit, Best Fit, First Fit Decreasing or Best Fit Decreasing and compare the count with the lower bound. How it works
Use the Bin Packing Optimizer
About the Bin Packing Optimizer
Items 3, 5, 2, 7 and 1 fit into 2 bins of capacity 10 with First Fit Decreasing: 7 + 3 and 5 + 2 + 1. The Bin Packing Optimizer also gives the lower bound, the total size divided by the capacity and rounded up (18 ÷ 10 gives 2): no packing can use fewer bins, so a result that reaches it is the fewest possible. For up to 25 items, Find the exact minimum searches for the proven fewest.
The four algorithms on items 2, 5, 4, 7, 1, 3 and 8, capacity 10
| Algorithm | Bins used | Packing | Utilization |
|---|---|---|---|
| First Fit (FF) | 4 | 2 + 5 + 1; 4 + 3; 7; 8 | 75.0% |
| Best Fit (BF) | 4 | 2 + 5 + 1; 4; 7 + 3; 8 | 75.0% |
| First Fit Decreasing (FFD) | 3 | 8 + 2; 7 + 3; 5 + 4 + 1 | 100.0% |
| Best Fit Decreasing (BFD) | 3 | 8 + 2; 7 + 3; 5 + 4 + 1 | 100.0% |
The sizes total 30, so the lower bound is 3 bins: FFD and BFD reach it, FF and BF do not.
Frequently asked questions
- What is the difference between First Fit and Best Fit?
- First Fit puts each item into the first bin that has room; Best Fit puts it into the bin where it leaves the least room. Both take the items in the order typed. The Decreasing versions sort the items from largest to smallest first: items 2, 5, 4, 7, 1, 3 and 8 need 4 bins of 10 with FF or BF and 3 with FFD or BFD.
- Does First Fit Decreasing always find the fewest bins?
- No. Bin packing is NP-hard and FFD is a heuristic. It never uses more than 11/9 of the optimum plus 6/9 of a bin (Dósa, 2007), and First Fit never more than 1.7 times the optimum, rounded down (Dósa and Sgall, 2013). When the result equals the lower bound the tool says it is the fewest possible; otherwise the fewest lies between the bound and the result. For 25 items or fewer, Find the exact minimum proves it: items 5, 6, 2, 2, 2 and 3 in bins of 10 take 3 bins with FFD (6 + 3, 5 + 2 + 2, 2), and the search finds 2 (6 + 2 + 2 and 5 + 3 + 2).
- Can I use decimal sizes?
- Yes, up to 9 decimal places. Sizes are added as exact decimals, so 0.1 and 0.2 fill a bin of 0.3 exactly, where floating-point arithmetic gives 0.30000000000000004 and would open a second bin.
- Can I paste a list of sizes?
- Yes. Paste them into Paste list, separated by commas, semicolons, spaces or new lines, and press Use pasted sizes: 3, 5, 2; 7 1 loads five sizes. The list replaces the rows, keeps the first 1,000 sizes, and says how many entries were not numbers and were left out.
- How is bin utilization calculated?
- Total size ÷ (bins used × capacity), rounded down to 0.1%: the starting 18 in 2 bins of 10 is 90.0%. Each bin's fill is rounded down to a whole percent, so 999.6 in a bin of 1000 reads 99% full and 99.9% utilization, never 100%.
- What if I do not have enough bins?
- The packing is still shown, with a note saying how many more bins it needs or that a larger capacity would do. The starting items with 1 bin available need 1 more bin.
Related Tools
View all toolsMoving Box Count Estimator
Moving box counts by size from your rooms, room size, packing method and how much you own, plus the wardrobe boxes and dish packs to add.
Laundry Load Size Estimator
Estimate how large your laundry load will be based on the number of people and how often you do laundry. Get a recommended washer capacity and visual load gauge.
Dunk Calculator
Jump needed to touch a 7 to 10 ft rim, dunk (6 in over) and power dunk (10 in over) from your standing reach, or a reach estimated as 1.335 x height.
Map Scale Calculator
Real distance from a map measurement and scale, the map distance for a real one, or the scale from both: at 1:50,000, 10 cm is 5 km.
Dice Probability Calculator
Odds of an exact, at-least or at-most total on 1 to 100 dice from d4 to d20, of one or every die showing a value, or of a d20 with advantage.
Tire Size Calculator
Tire size calculator: enter a size such as 225/45R17 to get sidewall height, overall diameter, circumference and revolutions per mile, or compare two sizes.