A print's cost is four numbers added together, and most published calculators show you only the first. This page explains each term, what it is sensitive to, and what a reasonable value looks like — so that when the calculator returns a figure you can tell whether to believe it.
Term one: filament
Filament cost is grams used multiplied by price per gram, and the only genuinely difficult part is the grams.
The grams figure you paste in comes from your slicer, and your slicer got it from the density field in the loaded filament profile. Leave that field at plain PLA's 1.24 g/cm³ while printing a matte grade at 1.30 or a metal-filled one at 3.2 and every cost this tool returns is wrong by the same ratio — which makes correcting that one field the highest-value thing on this list.
Price per gram is straightforward arithmetic on a 1 kg spool, but check what the spool weighs empty before assuming you got a kilogram of plastic. Reels vary from roughly 140 g of cardboard to about 250 g of plastic, and a spool sold as "1 kg" is a kilogram of filament, not a kilogram of package.
Term two: electricity
Electricity is wattage multiplied by hours multiplied by your rate, and every one of those three varies enough to matter.
Wattage should be the steady-state figure while printing, not the printer's power-supply rating. The rating is a ceiling — a machine with a 350 W supply typically settles somewhere between 60 and 130 W once the bed is up to temperature, and quoting the rating instead overstates the print by several times. The printer pages on this site record which of those two a figure is, and mark estimates as estimates.
Your rate is the one input nobody else can supply. Published national averages across the regions listed in the rate reference span roughly four to one, so an estimate computed at one country's average can be double or half the truth somewhere else. The calculator asks rather than assuming.
Term three: failures
A print that fails at 80% consumed 80% of the filament and 80% of the electricity and produced nothing. If you print for yourself, ignoring this is a reasonable choice. If you print for other people, it is how a job that looked profitable stops being profitable.
The honest way to set a failure allowance is to measure it: count the prints you started and the prints you kept over a month. A 5% failure rate means dividing your per-part cost by 0.95, which is a small correction. A 20% rate — common with a difficult material on an open-frame machine — is a 25% increase in real cost, which is not small at all.
Term four: machine time
Nozzles wear, belts stretch, build plates get scratched, hotends get replaced, and the machine itself has a finite life. Amortised over thousands of hours it is a small hourly figure, and it is the term most often left out entirely.
The useful way to think about it is a rough hourly rate rather than a precise depreciation model: purchase price spread over the hours you expect before replacement, plus consumables. Even a rough number is better than a zero, because zero is the only value that is certainly wrong.
Sanity-checking the result
Put a finished print on the scale and divide by what the slicer predicted. The ratio you get is your own machine's correction factor, and it beats any published average because it silently folds in purge, prime lines, supports and every small extrusion inaccuracy no model captures.
If you are working out material quantities for something other than a print — how much paint, concrete or tile a job needs — our sister site GetTheAmount runs the same kind of quantity-and-cost calculation at house scale.