SyntaxFlow

Metal · Cutting

Linear cutting optimizer

Paste the lengths you need, set the bar length and the blade's kerf, and it works out how to cut them from the fewest bars — which bar gets which pieces, which offcuts are long enough to keep, and a cut list to print. The example below, 54 pieces for a steel frame from 6 m bars, needs 10 bars: the theoretical minimum. Cutting one length at a time would take 13.

What to cut
Straight out of a spreadsheet, or typed with spaces. A blank quantity is 1; a header row is skipped.
The bars
Separated by spaces, e.g. 6500 7000. Each bar takes whichever length it uses best.
One per line: length and how many. These are used before any new bar.
The saw
Shorter ends count as waste.
—
Bars to buy
—
Waste
— %
Offcuts to keep
—
Lower bound
—

Everything runs in your browser; your list is kept in this browser only, so it is still here next time.

How the plan is worked out

Each bar loses the trim at both ends; what is left is the usable length. Every cut turns one kerf of material into dust, so a bar holding n pieces needs room for the pieces and the kerfs between them.

usable length U = bar − 2 × trim n pieces fit when Σ length + (n − 1) × kerf ≤ U lower bound bars ≥ Σ (length + kerf) / (U + kerf)

Two complete plans are built and the better one is kept. The first fills bar after bar with the combination of pieces that leaves the least behind, found by an exact search over what is still to cut. The second is best-fit decreasing: longest pieces first, each into the bar it fills best. On very long lists the first one is used to repack the bars the second left emptiest. Better means less new material bought, then fewer bars, then the longest offcut to keep.

It is a heuristic, not a proof of the optimum — which is why the lower bound sits next to the answer. Checked against an exhaustive search on 784 small jobs, it found the true minimum in 783.

Worked example you can check

The example list: 54 pieces, 6000 mm bars, 3 mm kerf, 10 mm trim at each end, offcuts from 500 mm kept.

BarsCuts, mmOffcut, mm
1850 + 600 + 600 + 600 + 600 + 450 + 450 + 450 + 450 + 450 + 4500
11200 + 850 + 600 + 600 + 450 + 450 + 450 + 450 + 450 + 4500
1850 + 850 + 850 + 850 + 850 + 850 + 8509
11650 + 1650 + 850 + 850 + 450 + 45062
11650 + 1650 + 1650 + 850168
11650 + 1650 + 1200 + 1200268
11650 + 1200 + 1200 + 1200718 · kept
11200 + 1200 + 1200 + 12001168 · kept
22400 + 24001174 · kept

10 bars, which is the lower bound, so no plan can use fewer. Waste 1.4 %, and 4 offcuts totalling 4234 mm go back on the rack. Cut one length at a time and the same list takes 13 bars.

What this page does not do