G-code Print Weight Calculator
Your slicer and G-code report the filament length a print consumes, but cost and spool tracking are easier in grams. Filament is a uniform cylinder, so its weight is its cross-section area times length times material density. This calculator takes the filament length, the filament diameter, and the material density from your data sheet, and returns the print weight in grams. Because density varies by polymer and brand, you enter it rather than relying on a fixed value.
G-code print weight formula
radius (cm) = diameter (mm) / 2 / 10
length (cm) = length (m) * 100
volume (cubic cm) = pi * radius^2 * length
weight (g) = volume * density
The cross-section of round filament is a circle, so area is pi times radius squared. Multiplying by length gives volume, and volume times density gives mass.
Worked example
For 10 m of 1.75 mm PLA at 1.24 g per cubic cm: radius = 0.0875 cm, length = 1,000 cm, volume = pi * 0.0875^2 * 1,000 = 24.05 cubic cm, weight = 24.05 * 1.24 = 29.83 g. Roughly 3 g per metre is a handy mental check for 1.75 mm PLA.
G-code print weight: frequently asked questions
How do I turn filament length into weight?
Filament is a cylinder, so its volume equals the cross-section area times the length used. The cross-section area is pi times the radius squared, where radius is half the diameter. Multiply volume by the material density to get mass. For 1.75 mm PLA at 1.24 g per cubic cm, one metre weighs about 2.98 g.
Where do I find the filament length?
Most slicers report the filament length used for a print in the slice summary, and it also appears in the G-code header as a comment. Enter that length here along with your filament diameter and material density to get the weight, which is useful for cost estimates and for checking remaining spool material.
What density should I enter?
Density depends on the polymer. Common reference values are about 1.24 g per cubic cm for PLA, 1.27 for PETG, and 1.04 for ABS, but exact density varies by brand and additives. Check your filament's technical data sheet and enter that value, since this calculator uses your entered density rather than a fixed assumption.
Does the slicer not already show weight?
Most do, but they assume a default density. If your filament differs, or you only have a length figure from old G-code, this calculator lets you apply the correct diameter and density to get an accurate weight.
Sources and method
- The cylinder volume formula (pi r squared times length) and mass equals density times volume are standard geometry and physics identities.
- National Institute of Standards and Technology: Office of Weights and Measures (SI units, density). Enter the density from your filament data sheet.
Reviewed by the CalculatorHub team, edited by James Graham, 19 June 2026. See our methodology.