About this calculator
This calculator estimates how much casing (architrave) trim to buy for a rectangular door or window opening — enter the opening size, the trim board's face width and thickness, which faces get trimmed, the corner joint style, and the stock length your trim is sold in. It packs the individual cut lengths onto real stock boards (not a simple total-length division) and reports exactly how many boards of that profile to buy — casing is sold as a three-dimension product (thickness x width x stock length, e.g. 16x70x2200), so a board count with no thickness is not something you can walk into a shop and ask for.
Formula
The calculator converts every input to whole millimetres, then builds the list of cut lengths one face's frame needs:
mitred vertical run = openingHeight + trimWidth
mitred head/sill run = openingWidth + 2 x trimWidth
butt vertical run = openingHeight
butt head/sill run = openingWidth
A mitred vertical run is extended by one trim width because that is the overlap a 45-degree mitre needs to close cleanly against the head above it; a butt joint's head simply rests on top of a plain-height vertical, so no extension is needed there. The sill run (only present when "include bottom run" is on) is assumed to follow the same mitre/butt formula as the head — the two are symmetric pieces closing the frame from opposite ends.
One face needs two vertical runs, one head run, and (optionally) one sill run. Trimming both faces of the opening doubles that list. Multiplying by the opening count repeats it again.
net length per opening = sum of that opening's own cut lengths
net length total = net length per opening x opening count
Stock-length packing is the actual point of this calculator. A naive
total length / stock length division silently assumes cut lengths can be sliced
across board boundaries, which a rigid trim board cannot do — two 1.3 m verticals
cannot come from one 2.2 m board's own 1.3 m of "average" length if the board can only
be cut once for each. Instead every individual cut length is packed onto boards with a
first-fit-decreasing algorithm: the longest cuts are placed first, each into the first
board with enough length left, opening a new board only when none fits.
Waste is applied to length, before packing — not as a whole extra board tacked on afterward. The waste percentage is converted into an extra length allowance, split into stock-length-sized (or smaller) pieces, and packed through the very same first-fit-decreasing pass as the real cuts, so a waste allowance can share a board with a real cut's own leftover offcut instead of always claiming a whole board of its own:
waste length = round_up(net length total x waste% / 100)
waste pieces = waste length split into pieces no longer than stock length
boards required = first-fit-decreasing bin count over (real cuts + waste pieces)
offcut remaining = boards required x stock length - net length total
If any single required real cut is longer than the stock length itself, the calculator returns an error instead of a board count — no board is long enough to cut it from at all. (This check runs on the real cut length, not the waste-inflated total — waste is extra length to be packed, never a reason an ordinary cut is declared impossible.)
Worked example
Defaults except sides = both faces: 900 x 2100 mm door, 70 mm trim width, mitred corners, no sill, 2200 mm stock, 10% waste, 1 opening.
mitred vertical run = 2100 + 70 = 2170 mm
mitred head run = 900 + 2x70 = 1040 mm
one face's runs: 2170, 2170, 1040
both faces (doubled): 2170, 2170, 1040, 2170, 2170, 1040
net length total = 2 x (2 x 2170 + 1040) = 10,760 mm
waste length = round_up(10,760 x 10 / 100) = 1,076 mm
1,076 mm is under the 2,200 mm stock length, so it is one waste piece: 1,076 mm.
packing 2170, 2170, 2170, 2170, 1076, 1040, 1040 into 2200 mm boards, longest first:
board 1: 2170 (30 mm left) board 2: 2170 (30 mm left)
board 3: 2170 (30 mm left) board 4: 2170 (30 mm left)
the 1076 mm waste piece fits none of the 30 mm remainders -> board 5: 1076
the first 1040 mm run fits board 5's own 1124 mm remainder -> board 5 holds both
the second 1040 mm run fits none of the remaining boards -> board 6: 1040
boards required = 6
offcut remaining = 6 x 2200 - 10,760 = 2,440 mm
The calculator returns exactly this: 6 boards, with 2,440 mm of offcut left over and 4 corner joints to cut. (This particular input happens to land on the same board count the old pack-then-add-a-whole-board approach produced — see the FAQ below for why that is a coincidence, not the general case.)
FAQ
Why does the board count sometimes come out higher than total length divided by stock length? Because that division assumes cuts can be sliced across board boundaries — real trim boards can't. A run that is, say, 1.2 m long on a 2.2 m board leaves 1.0 m of remainder that a second 1.2 m run cannot use, even though "on average" two of them would fit in 2.4 m of stock. The nested packing this calculator performs accounts for that; a naive division can under-order boards.
Why doesn't the waste percentage always add a whole extra board?
Because it no longer works that way. Earlier versions of this calculator packed the
real cuts, then always tacked on round_up(board count x waste% / 100) more boards —
which ignored any offcut the packing already left over, double-counting material that
was already spare. Now the waste allowance is extra length, packed through the same
nesting pass as the real cuts, so it can land in an existing board's own leftover
offcut instead of always claiming a new board. The worked example above happens to
still land on 6 boards either way, but that is a coincidence of that particular input,
not a guarantee — a job whose packing already leaves a large offcut can need no extra
boards at all for its waste allowance under the current rule, where the old rule would
always have added at least one.
Why does the calculator ask for trim thickness if it doesn't change any of the numbers above? Because a board count on its own isn't something you can buy. Casing is sold as a three-dimension profile — thickness x width x stock length, e.g. 16x70x2200mm — and 16x70x2200 is a different product from 12x60x2200. Thickness never enters a length formula (it has nothing to do with how much material a cut needs), but leaving it out would mean the calculator's own answer names a quantity without naming the product it's a quantity of. It appears in the parts list and in the board-profile note next to the board count instead.
What does "corner count" tell me? The total number of corner joints in the whole job (2 per face without a sill, 4 with one; doubled for both faces, multiplied by opening count) — useful for sanity-checking how many cuts your mitre saw setup needs to produce, whichever joint style you chose.
Why is there no bottom run by default? A door has no casing below floor level. Turn on "include bottom run" for a window that needs a sill-height apron trim as well.
Where does the stock length default come from? 2200 mm is a commonly stocked casing length at many suppliers, but it is not verified against any specific supplier's catalogue and is not a standard — enter your own product's actual length.
What standard does this calculator cite?
None. Casing/architrave take-off is trade practice, not a dimensional or building-code
requirement, so meta.standards is deliberately left empty.
Assumptions and limits
No standard was found for trim take-off quantities, mitre allowance, or stock length —
these are trade-practice figures, not code requirements, so meta.standards is
deliberately empty.
Mitre material consumption is modelled entirely through the run-length formulas above (a mitred vertical gains one trim width, a mitred head/sill gains two) — the exact geometric overlap a 45-degree mitre needs. No separate saw-kerf allowance is added on top of that: a blade kerf is on the order of a couple of millimetres, far below the whole-board rounding the packing step already performs, so adding a distinct figure for it would be an invented precision, not a real norm.
The sill run reuses the head run's own formula. The task this calculator was built from does not separately define the sill's length; since the sill and head are symmetric pieces closing the same two verticals from opposite ends, reusing the head formula is the natural reading, not an independently-sourced figure.
Stock length's 2200 mm default is an example, not a catalogued figure — see the FAQ above.
Trim thickness never enters a length formula. It exists only so the board being counted is a real, buyable product (thickness x width x stock length) — see the FAQ above for why it is still a required input despite that.
Waste is modelled as extra length, chunked to stock-length-sized pieces and packed alongside the real cuts — not by inflating each individual run by the waste percentage. Inflating every run was considered and rejected: at this calculator's own defaults, a 10% per-run inflation would push the default 2170 mm mitred vertical run to 2387 mm, which exceeds the default 2200 mm stock length and turns an ordinary default configuration into a hard error, purely from an accounting choice rather than a real material shortage. Treating waste as extra packed length avoids that failure mode.
The drawing shows one representative face's elevation (opening outline, the four — or three, without a sill — trim runs as their own outlines, each one board's true shape including its own mitred end where applicable). A mitred corner is drawn as exactly one diagonal line, which is that corner's own two boards' shared cut edge, not a separate annotation added on top of a square-cut outline. The drawing does not attempt to show both faces at once when "both faces" is selected, since they are physically identical trim on opposite sides of the same wall.