The formula for the weight of a pane of glass or a steel bar fits in one line. The wrong answers still turn up constantly, and nearly always because of the inputs: a density from memory, millimetres mixed with metres, a decimal comma read as a thousands separator. These are the notes from building the weight calculators in SyntaxFlow, with code taken from the repository.
Glass: one number, and where it comes from
Soda-lime float glass has a density of 2500 kg/m³ (EN 572-1). Since 1 mm of thickness over 1 m² is 0.001 m³, that is 2.5 kg per m² for every millimetre:
// weight = length × width × thickness × density
kg = area * tGlass / 1000 * RHO_GLASS; // area in m², tGlass in mm, RHO_GLASS = 2500
A 1.2 × 2.2 m pane of 6 mm glass is 1.2 × 2.2 × 6 × 2.5 = 39.6 kg. A jumbo sheet of 3210 × 2250 mm is 7.22 m²: about 108 kg in 6 mm and 181 kg in 10 mm. I recomputed those figures with the plain formula and they match the ones on the page.
Laminated glass adds the interlayer. The page takes PVB at 1070 kg/m³:
if (mk === "lam") kg += area * interlayerMm / 1000 * RHO_PVB; // RHO_PVB = 1070
So 66.2 (two 6 mm panes and 0.76 mm of PVB) is 12 × 2.5 + 0.76 × 1.07 = 30.81 kg/m², which the page rounds to 30.8. The interlayer is under 3 % of that, and it is the part people forget.
What is deliberately left out: the air or argon in an insulating unit (about 0.03 kg/m² for a 16 mm argon cavity, under a tenth of a per cent), spacers, sealant and coatings. The page says that the result runs slightly under the delivered weight, by roughly one to two per cent. For a crane or a hoist, you still add a margin; the calculator is not a delivery note.
Two typical errors here. One is reading the product name as a thickness: "33.1" is 3 + 3 mm of glass plus interlayer, so 6 mm of glass, not 33. The other is a double glazed unit "4-16-4": the 16 is the cavity and weighs nothing, so the unit is 8 mm of glass, 20 kg/m², not the 60 kg/m² you get by weighing 24 mm.
Steel, aluminium and friends: density per material, area per shape
For bars and tubes the weight per metre is the cross-section area times the density. SyntaxFlow keeps both in two small tables. Densities, in kg/m³, with the source named in the code comments:
steel: { rho: 7850 }, // carbon structural steel, ArcelorMittal Orange Book
stainless: { rho: 7900 }, // 304 / 1.4301, Euro Inox
stainless316: { rho: 8000 }, // 316 / 1.4401, Euro Inox
aluminium: { rho: 2700 }, // 6060, 6063, 6082, supplier data sheets
brass: { rho: 8440 }, // CuZn37
copper: { rho: 8940 }, // Cu-DHP
A comment in the file records something worth copying: copper, brass and zinc were changed on 31 October 2026 because the earlier numbers had no source, and grey cast iron at 7200 still has none, which the file admits. A calculator that cites nothing cannot be corrected; one that cites a data sheet can. A density from the reader's own supplier beats every default.
Area comes from the shape, in mm², and the weight per metre is A * rho / 1e6:
squaretube: { dims: ["a","t"], area: d => d.a*d.a - (d.a - 2*d.t)**2 },
round: { dims: ["d"], area: d => Math.PI * d.d * d.d / 4 },
angle: { dims: ["a","b","t"], area: d => d.t * (d.a + d.b - d.t) },
hex: { dims: ["s"], area: d => Math.sqrt(3)/2 * d.s * d.s }, // s = across flats
function perMetre(shape, d, rho){
var A = area(shape, d);
return A === null ? null : A * rho / 1e6; // kg/m
}
Running it for steel (7850): a 40 × 3 mm square tube is 3.49 kg/m, a 20 mm round bar 2.47 kg/m, a 50 × 5 flat 1.96 kg/m, a 60 × 40 × 3 rectangular tube 4.43 kg/m, and a 20 mm across-flats hexagon 2.72 kg/m. Sheet is handled per square metre instead: 2 mm steel plate is 15.7 kg/m².
The geometry is sharp-cornered, and the code says so
Real hollow sections have rounded corners (EN 10219, EN 10210), and angles and channels have root and toe radii. A formula built from nominal dimensions ignores all that. The header of the file states the consequence: figures run a few per cent high for rolled hollow sections (more for thick walls) and a little low for hot-rolled angles, compared with manufacturers' tables. So the calculator is right for estimating, and for anything ordered or designed by weight you should take the table of the actual product. Writing that limit down costs nothing.
Impossible geometry returns null, not a number
A 40 mm tube with a 25 mm wall has a negative inner dimension and, squared, a positive and wrong area. The function refuses it:
case "squaretube": return 2*d.t < d.a;
case "angle": return d.t < d.a && d.t < d.b;
It returns null, and the page shows what is wrong instead of a plausible weight. Squaring negative numbers is how bad inputs produce good-looking output.
Units and input: where most of the wrong answers are born
The sheet-material calculator (MDF, chipboard, plywood) keeps the whole thing to three lines:
// weight per m² = density (kg/m³) × thickness (m); per sheet × length (m) × width (m)
var kgm2 = o.rho * o.t / 1000, area = o.L * o.W / 1e6, one = kgm2 * area;
return { kgm2, area, one, total: one * o.n };
An MDF sheet of 2440 × 1220 × 18 mm at 750 kg/m³ is 13.5 kg/m², 2.9768 m² and 40.19 kg per sheet; ten sheets are 401.9 kg, which is why somebody has to know before the van arrives. The 750 is the value for 12-19 mm boards from a manufacturer's data sheet, and the pages print the range (710 to 780) next to it.
The precautions that matter:
-
Limits per field. Density 1-3000 kg/m³, thickness up to 300 mm, sides up to 20 000 mm, quantity a whole number from 1 to 100 000. Outside that,
weighreturns{ err: "t" }naming the field, not a number. - One unit inside. Everything is mm, kg/m³ and kg internally. Pounds use the exact constants (1 lb = 0.45359237 kg, 1 ft = 0.3048 m), so 1 ft² is 0.09290304 m², not a typed 0.0929.
-
Lengths as people write them. The parser accepts
18,18.5,18,5,3/4,23/32and1 1/8. A decimal comma on a decimal-point page is read as a decimal sign when one or two digits follow it (18,5), but2,440is refused and not guessed: it could be a thousand and it could be two and a half. When the input is ambiguous, ask.
if (/^\d+,(\d{1,2}|\d{4,})$/.test(s)) s = s.replace(",", ".");
// "2,440" matches neither branch: NaN, the field is flagged
I ran the parser: 18,5 gives 18.5, 3/4 gives 0.75 and 2,440 gives NaN.
A checklist
- State the density and its source next to the result.
- Keep one unit internally and convert at the edges, with exact constants.
- List what is ignored (cavity gas, corner radii, coatings) and the direction of the error.
- Reject impossible geometry instead of computing it.
- Refuse ambiguous numbers.
The glass calculator is at syntaxflow.io/glass/weight/ and the metal one at syntaxflow.io/metal/weight/. Both are free and need no sign-up.
I'm the author of SyntaxFlow, the set of workshop calculators this article is about.
Written with the help of an AI assistant; the code, the figures and the claims were checked against the repository before publishing.
Top comments (0)