GenerateRandomSearch

Strip Packing Generator

Fitting rectangles into a fixed width so the total height is as small as possible turns up wherever material comes in rolls — fabric, sheet metal, label stock. It is a genuinely hard problem, so the practical approach is a shelf: sort by height, fill a row across the width, start a new row when the next piece will not fit. This shows that packing next to the height no arrangement could beat, so the gap between them is visible.

What this generator does

Generates rectangles that each fit within the strip, sorts them tallest first, and fills shelves across the width. It reports the height used, how much of that area the pieces actually cover, and the height that total area would need if it could be poured in perfectly.

How to use this tool

  1. Choose how many pieces and how wide the strip is.
  2. Look at the wasted space above the shorter pieces on each shelf.
  3. Compare the height used against the best possible figure shown.
  4. Try a wider strip and watch the efficiency change.

Understanding the controls

How many pieces
Between 3 and 24 rectangles. More pieces usually pack proportionally better, because the gaps have more chances to be filled.
Strip width
The fixed width everything must fit inside. Pieces are never generated wider than this, since nothing could place them.
Seed
Any word reproduces exactly the same pieces and the same packing.

Common use cases

  • Teaching two-dimensional packing and why it is harder than one dimension
  • Estimating material use for cutting from a roll
  • Test instances for a packing implementation
  • Showing what sorting by height buys you before packing
  • Setting the same problem twice from a seed

How this generator works

Sorting by height first is what makes shelves work: a shelf is as tall as its tallest piece, so mixing a tall piece with short ones wastes the difference across every short one. The check is geometric and blunt — every pair of rectangles is tested for overlap, every piece is confirmed inside the strip, and the reported height is compared against the topmost edge actually used.

Randomness and fairness

The piece sizes are random; the packing is then computed and checked. A seed reproduces the same pieces exactly and is therefore explicitly not cryptographically secure. Without a seed the browser's cryptographically secure generator is used.

For how randomness is produced across the whole site, see how Generate Random works.

Limitations and good to know

  • Shelves only. The best known approaches fit pieces into gaps rather than rows and do noticeably better.
  • Pieces are never rotated, which rules out an easy improvement real nesting software uses.
  • Whole-number sizes, which keeps the arithmetic checkable rather than realistic.
  • The lower bound shown is the total area divided by the width — no packing can beat it, but it is often unreachable.
  • A layout is gone on reload — copy the cut list or note the seed.

Privacy and your data

The pieces and the packing are computed entirely in your browser. Nothing about the layout or your seed is transmitted or kept.