Solve 1D Bin Packing Problems using First Fit Decreasing (FFD) and Best Fit Decreasing (BFD) heuristics with theoretical minimum lower bounds.
Did this calculation save you time?
Student ProjectHi! I'm a student developer building Calculat in my spare time. I was tired of searching for basic math tools and having to click through 10 spammy popups, loan ads, and cookie trackers.
I keep this website 100% free, private, and ad-free. If this helped you with your homework, project, or finances today, bookmarking this page or telling a friend helps me keep building more free tools!
The Bin Packing Calculator solves the classic one-dimensional Bin Packing Problem, an NP-hard combinatorial optimization problem where items of different sizes must be packed into a minimum number of fixed-capacity bins.
B_{\text{min}} \ge \left\lceil \frac{\sum_{i=1}^n w_i}{C} \right\rceil, \quad \text{FFD}(I) \le \frac{11}{9} \text{OPT}(I) + \frac{6}{9}Where w_i are item weights and C is bin capacity. The First Fit Decreasing heuristic is guaranteed never to use more than 11/9 of the optimal bin count.
Scenario: Packing items [5, 4, 3, 2, 7, 8, 1, 6, 2, 4] into bins of capacity 10
Total item weight: 5 + 4 + 3 + 2 + 7 + 8 + 1 + 6 + 2 + 4 = 42.
Theoretical minimum bins: ⌈42 / 10⌉ = 5 bins.
Sort descending: [8, 7, 6, 5, 4, 4, 3, 2, 2, 1].
FFD assignment: Bin 1: [8, 2], Bin 2: [7, 3], Bin 3: [6, 4], Bin 4: [5, 4, 1], Bin 5: [2].
It is a foundational computer science optimization problem: given items of varying sizes, pack them into the minimum number of identical bins of fixed capacity.
Sorting items from largest to smallest before packing prevents large items from being stranded late in the process, delivering solutions within ~22% of optimal in polynomial time.
Common applications include logistics cargo loading, cloud computing server virtualization (packing virtual machines onto physical servers), and cutting stock problems in paper/steel mills.
First Fit places an item in the first bin that can hold it. Best Fit searches for the bin with the tightest remaining space that can accommodate the item.
Calculate how many smaller product boxes fit inside a master carton or shipping container across all 6 3D spatial rotations to maximize volume utilization.
Calculate dimensional (DIM) weight for FedEx, UPS, and USPS. Determine billable weight, box cubic volume, girth, and oversize packaging surcharges.
Calculate sphere packing density, discrete count, Kepler maximum theoretical bound (74.05%), and void volume in boxes, cylinders, and vessels.