Methodology: every formula, constant and source
By Rohit GaurLast updated October 11, 2026Report a mistake
A calculator is only worth using if you can check it. This page lists the formula behind every shape, the exact value behind every unit, the rounding rules, and the tests that keep them honest. The tables below are generated from the calculator’s own code at build time — nobody retypes a number into this page, so what is published and what runs cannot drift apart.
Formulas
Rectangle
- Area
- length × width
- Perimeter
- 2 × (length + width)
Square
- Area
- side × side
- Perimeter
- 4 × side
L-shape
- Area
- length × width − cut-in length × cut-in width
- Perimeter
- 2 × (length + width)
Cutting a rectangular corner out leaves the perimeter unchanged: the two new inner edges are exactly as long as the outer edges they replace.
Triangle (base and height)
- Area
- base × height ÷ 2
Height is the perpendicular distance to the base, not the length of a side. Two numbers do not determine the three sides, so no perimeter is shown.
Triangle (three sides)
- Area
- ¼ √( (a + (b + c)) · (c − (a − b)) · (c + (a − b)) · (a + (b − c)) ), sides sorted a ≥ b ≥ c
- Perimeter
- a + b + c
Kahan's rearrangement of Heron's formula. The textbook form subtracts nearly equal numbers on thin triangles and loses most of its digits; this grouping does not.
Circle
- Area
- π × radius² (× ½ for a half, × ¼ for a quarter)
- Perimeter
- 2π × radius, plus 2 × radius for the straight edge of a half or quarter
Trapezoid
- Area
- (side A + side B) ÷ 2 × height
- Perimeter
- side A + side B + both slanted sides, when they are given
Parallelogram
- Area
- base × height
- Perimeter
- 2 × (base + slanted side), when the slanted side is given
Height is again the perpendicular distance, which is why a parallelogram and a rectangle of the same base and height have the same area.
Four walls + diagonal
- Area
- the two triangles the diagonal makes, each by Kahan's formula, added
- Perimeter
- wall A + wall B + wall C + wall D
Four walls do not describe a shape — the same four enclose less area the more the room leans — so a diagonal is measured too, and it splits the room into two triangles whose sides are all known. Measure the other diagonal as well and the room is described twice over: the difference between the second diagonal and the one the first five numbers imply is how far out of square the corners are.
Drawn shape
- Area
- ½ |Σ (xᵢ · yᵢ₊₁ − xᵢ₊₁ · yᵢ)| — the shoelace formula
- Perimeter
- the sum of the edge lengths
Points are taken relative to the first corner and summed with compensated arithmetic, and the outline is rejected if it crosses itself, using an exact orientation predicate.
Conversion constants
These are definitions, not measurements: an inch is 25.4 millimetres, exactly, by international agreement. The calculator converts through exact integer ratios rather than through these decimals, so 12 inches is exactly 1 foot and 1 acre is exactly 43,560 square feet with no floating-point dust.
Length
| 1 unit | exactly | in |
|---|---|---|
| mm | 0.001 | m |
| cm | 0.01 | m |
| m | 1 | m |
| km | 1000 | m |
| in | 0.0254 | m |
| ft | 0.3048 | m |
| yd | 0.9144 | m |
| mi | 1609.344 | m |
NIST Handbook 44 (2026), Appendix C: General Tables of Units of Measurement · Special Publication 811, Appendix B: Conversion factors · U.S. Survey Foot: Deprecation
Area
| 1 unit | exactly | in |
|---|---|---|
| mm² | 0.000001 | m² |
| cm² | 0.0001 | m² |
| m² | 1 | m² |
| km² | 1000000 | m² |
| in² | 0.00064516 | m² |
| ft² | 0.09290304 | m² |
| yd² | 0.83612736 | m² |
| mi² | 2589988.110336 | m² |
| ac | 4046.8564224 | m² |
| ha | 10000 | m² |
NIST Handbook 44 (2026), Appendix C: General Tables of Units of Measurement · Special Publication 811, Appendix B: Conversion factors · U.S. Survey Foot: Deprecation
Volume
Volume units are here because the material estimators use them.
| 1 unit | exactly | in |
|---|---|---|
| cm³ | 0.000001 | m³ |
| m³ | 1 | m³ |
| in³ | 0.000016387064 | m³ |
| ft³ | 0.028316846592 | m³ |
| yd³ | 0.764554857984 | m³ |
| L | 0.001 | m³ |
| US gal | 0.003785411784 | m³ |
| imp gal | 0.00454609 | m³ |
NIST Handbook 44 (2026), Appendix C: General Tables of Units of Measurement · Special Publication 811, Appendix B: Conversion factors · U.S. Survey Foot: Deprecation
The United States survey foot is deliberately absent. NIST retired it on 31 December 2022, and since 1 January 2023 the international foot — exactly 0.3048 metres — is the only foot in use.
Land units of South Asia
These are not definitions the way an inch is. A bigha is whatever a particular state’s land records say it is, and the same word means 14,400 square feet in West Bengal and 9,075 in the bigha-biswa districts of Haryana. So every one below carries the government document it was read from and the date somebody opened it, and the converter makes you pick a region before it answers.
Where a source calls its own figure approximate — Bihar’s glossary on the kattha, Bangladesh’s Ministry of Land on the katha and bigha — the tables here and the converters both say so with a ≈ rather than printing four decimals of false precision.
India
| Unit | Where the land is | ft² | m² | Source and definition |
|---|---|---|---|---|
| Gaj | Across India | 9 | 0.84 | NIST1 gaj = 1 square yard = 9 sq ft |
| Cent | Across India | 435.6 | 40.47 | MDDS1 acre = 100 cents, so 1 cent = 435.6 sq ft |
| Guntha | Across India | 1,089 | 101.17 | MDDS1 acre = 40 gunthas, so 1 guntha = 121 sq yd = 1,089 sq ft |
| Bigha | West Bengal | 14,400 | 1,337.8 | NGDRS1 bigha = 20 katha = 14,400 sq ft |
| Bigha | Assam | 14,400 | 1,337.8 | Guwahati bylaws1 bigha = 5 katha = 14,400 sq ft |
| Bigha | Haryana | 9,075 | 843.1 | MDDS4 bigha 16 biswa = 1 acre, so 1 bigha = 9,075 sq ft |
| Katha | West Bengal | 720 | 66.89 | NGDRS1 katha = 720 sq ft, and 20 katha = 1 bigha |
| Katha | Assam | 2,880 | 267.56 | Guwahati bylaws1 katha = 20 lessa = 2,880 sq ft |
| Katha | Bihar (Patna) | ≈ 1,361 | ≈ 126.44 | Bihar revenue glossary1 kattha ≈ 1,361 sq ft in and around Patna |
| Katha | Jharkhand | ≈ 720 | ≈ 66.89 | MDDS1 katha = 66.89 m² ≈ 720 sq ft |
| Biswa | Haryana | 453.75 | 42.15 | MDDS1 bigha = 20 biswa, so 1 biswa = 453.75 sq ft |
| Marla | Haryana and Punjab | 272.25 | 25.29 | MDDS8 kanal = 1 acre and 20 marla = 1 kanal, so 1 marla = 272.25 sq ft |
| Kanal | Haryana and Punjab | 5,445 | 505.86 | MDDS8 kanal = 1 acre, so 1 kanal = 20 marla = 5,445 sq ft |
| Lessa | Assam | 144 | 13.38 | MDDS1 lessa = 144 sq ft |
| Chatak | West Bengal | 45 | 4.18 | NGDRS1 chatak = 45 sq ft, and 16 chatak = 1 katha |
| Dhur | Bihar (Patna) | ≈ 68.05 | ≈ 6.32 | Bihar revenue glossary1 dhur = 1/20 kattha ≈ 68.05 sq ft around Patna |
| Kani | Tripura | 17,280 | 1,605.36 | Tripura land records20 ganda = 1 kani = 17,280 sq ft |
| Gonda | Tripura | 864 | 80.27 | Tripura land records4 kara = 1 ganda = 864 sq ft |
| Kora | Tripura | 216 | 20.07 | Tripura land records3 kranta = 1 kara = 216 sq ft |
Bangladesh
| Unit | Where the land is | ft² | m² | Source and definition |
|---|---|---|---|---|
| Cent | Bangladesh | ≈ 435.6 | ≈ 40.47 | Bangladesh Ministry of Land1 decimal (shotangsho) ≈ 435.6 sq ft |
| Katha | Bangladesh | ≈ 720 | ≈ 66.89 | Bangladesh Ministry of Land1 katha ≈ 720 sq ft, and 16 chatak = 1 katha |
| Bigha | Bangladesh | ≈ 14,400 | ≈ 1,337.8 | Bangladesh Ministry of Land20 katha = 1 bigha ≈ 14,400 sq ft |
| Chatak | Bangladesh | 45 | 4.18 | Bangladesh Ministry of Land1 chatak = 45 sq ft |
| Kani | Bangladesh | 17,280 | 1,605.36 | Bangladesh Ministry of Land1 kani = 20 gonda = 17,280 sq ft |
| Gonda | Bangladesh | 864 | 80.27 | Bangladesh Ministry of Land4 kora = 1 gonda = 864 sq ft |
| Kora | Bangladesh | 216 | 20.07 | Bangladesh Ministry of Land3 kranti = 1 kora = 216 sq ft |
Three units people ask for are deliberately missing: Rajasthan’s bigha (two jaribs, one source), Pakistan’s marla (225 square feet in Lahore’s planned schemes against 272.25 on the old records, and no government copy of the rules we could open on 21 September 2026), and the Tamil Nadu ground of 2,400 square feet, which is quoted everywhere and stated in no document we could find. A land unit is worth more missing than wrong.
Garden materials: volume, compaction and weight
The mulch, gravel and topsoil calculators share one piece of arithmetic, and it is short:
- Volume is the area times the depth, plus whatever extra you ask for. A cubic yard is 27 cubic feet, so a yard spread an inch deep covers 324 square feet — the figure Clemson’s fact sheet quotes, and a test holds the engine to it. A cubic metre spread 2.5 cm deep covers 40 m².
- A compacted depth is ordered loose. When the depth you give is the finished depth of a base that will be compacted, the order is the loose lift that compacts to it, at the one ratio a source here gives for it (below). A loose cubic yard, or a bag, is taken to cover finished ground at the finished depth: the part that packs down covers nothing.
- Weight is the loose volume times what a cubic foot of it weighs. Tons are US short tons of 2,000 lb; tonnes are 1,000 kg. The weight field starts on a published figure and takes your supplier’s over it; a figure you type is kept in the unit you typed it in, so switching between feet and metres converts it rather than changing what it means.
- Bags are counted whole, rounded up with the same slack as every other count on the site, so 25 litres of mulch in 25 litre bags is one bag. A bag labelled by weight — British gravel comes in 20 kg bags and 800 kg bulk bags — holds that weight of stone, so it is counted as the weight of the job over the weight of the bag, which needs the weight field filled in.
| Material | Tons (2,000 lb) a cubic yard | Tonnes a cubic metre | Pounds a cubic foot | Source |
|---|---|---|---|---|
| Gravelloose, as delivered | 1.62 | 1.92 | 120 | Penn State DSA handbook |
| Topsoildry, in place | 1.12 | 1.33 | 83.03 | Penn State Extension |
Compacting: a depth given as finished is ordered 1.333 times as deep — the handbook's 8 in loose lift for 6 in finished. It is the only compaction ratio any source here gives, so it is the one used for every compacted depth.
| Material | Depths offered, and what for | Source |
|---|---|---|
| Mulch |
| |
| Gravel |
| |
| Topsoil |
|
The cubic yard calculator is the same arithmetic over several sections: each is a rectangle (length × width), a circle (π × half its width squared), a triangle (half its base × its height) or an area already known, times its own depth; the sections are added with compensated summation, and the extra, the weight and the bags are worked out on the total.
Sod has no depth. The sod calculator orders the lawn’s area plus the extra, counts pieces and pallets as whole things with the same slack as every other count, and weighs the order at the University of Tennessee’s figure — about a ton for a pallet of about 50 square yards — which is a figure for planning a delivery, not a scale: wet sod weighs more.
Building: pavers, concrete, the roof, the deck, insulation and siding
- Pavers are counted by the space each one takes with its joint. A paver L long and W wide with a joint J takes (L + J) × (W + J), so an area needs the area over that, plus the extra — 5 per cent, or 10 where a lot is cut, as Oregon State’s installation guide gives them. The base is the area times its compacted depth, ordered loose at the ratio Penn State’s road handbook lays it (8 inches loose for 6 finished) and weighed at the gravel page’s figure; the dig is the base, the bedding sand and the paver’s thickness together. The joint, the base depths and the inch of sand are ICPI’s (Tech Spec 2).
- Concrete is worked out pour by pour: a slab, footing or wall is length × width × depth; a round hole or column π × (half its width)² × its depth; a slab of known area, the area times its thickness; and n solid steps are width × rise × run × n(n + 1) ÷ 2, because each tread stands on every rise below it. Pours are added with compensated summation, the allowance goes on the total — 4 to 10 per cent, as the National Ready Mixed Concrete Association advises — and bags are the total over one bag’s yield as its maker prints it.
- A roof’s area is its plan area times √(1 + (rise ÷ 12)²), which is exact for a footprint of any shape as long as every slope has the same pitch. On a rectangle the edges follow: a gable has a ridge as long as the roof, two eaves and four rakes each half the width times the slope factor; a hip has a ridge the length less the width, eaves all round and four hips each √(2 + (rise ÷ 12)²) times half the width. The ice barrier reaches from the eave’s edge to 24 inches inside the walls, measured up the slope, and at least 36 inches from 8 in 12 (IRC R905.1.2); on a hip roof each strip is a trapezoid whose ends the hips cut off at 45°. Bundles are counted from the coverage Owens Corning prints, 98.4 square feet to a square.
- A deck is ⌈(width + gap) ÷ (board + gap)⌉ rows — one fewer when no more than a gap is left over, and a warning when the last row is short of a board by more than half a gap, since the TDCA’s code asks for no board to be cut along its length. A row no longer than a board is cut from one, as many to a board as fit; a longer one is whole boards joined over joists — as much of each board as reaches its last joist — and an end piece, as many end pieces to a board as fit. Joists are ⌈length ÷ spacing⌉ + 1, and screws two in every board at every joist, as both Trex and the TDCA ask.
- Blown insulation is counted from the chart on the bag. A chart gives each R-value a minimum number of bags per 1,000 square feet and a maximum area per bag, and its rounding can set the two a bag apart; the page keeps to both, so the count is ⌈max(area ÷ coverage, area × bags per 1,000 ÷ 1,000)⌉, with the chart’s minimum depth beside it — Owens Corning and Greenfiber each say the R-value needs the bags and the depth together. A target between two rows takes the next row up. Depth markers are ⌈area ÷ 300 sq ft⌉, as the IRC asks (N1101.10.1.1). Batts are counted by the framing they sit between: each covers its length times the spacing.
- Siding is walls at length × height and gable ends at ½ × width × height, less what the maker’s own method takes off for openings: the vinyl makers (the Vinyl Siding Institute and CertainTeed) count windows and doors in and take half of a large opening off, then add 10 per cent; James Hardie counts the walls less every opening and leaves waste out. A piece covers its length times its exposure. Starter strip runs along the base, J-channel round every opening and up every rake, and a corner post down each corner, spliced with the institute’s 3/4 in lap when the wall is taller than a post. House wrap covers the gross wall, at (9 ft − 6 in) × (150 ft − 12 in) a roll after DuPont’s laps.
Rounding
- Every calculation runs at full double precision. Rounding happens once, on the way to the screen.
- Areas and lengths are shown to two decimals, unit conversions to four, and a measurement you typed is echoed back with up to six.
- Unit conversion uses an exact integer ratio rather than two decimal factors, so 12 inches is exactly 1 foot and 1 acre is exactly 43,560 square feet.
- Waste, price and tax are applied to the unrounded area, so a rounded number is never multiplied by another rounded number.
- Room totals are added with compensated summation, so a 1,200 sq ft great room and a 6.25 sq ft cupboard still add up exactly.
- Anything sold in whole units — boxes, tiles, rolls, sheets, lengths of trim, pails, bags, pavers, deck boards, shingle bundles — is rounded up after the waste is added, never down. A count a hair above a whole number from floating-point noise is taken as that number, so 12 ft of trim in 4 ft lengths is 3 pieces, not 4.
- Paint in US units is rounded up to the next quart and shown as gallons and quarts. On a metric page it is packed into the tin sizes you stock: the least paint that covers the job, then the fewest tins.
- Materials cut from a roll are cut before they are counted: carpet is laid in whole roll widths, a wallpaper drop is rounded up to whole pattern repeats, and a roll gives only whole drops. The count follows the cuts, not the area.
How the maths is tested
Every formula has unit tests with fixed, checkable cases: a 12 × 12 room is 144 square feet, a 3-4-5 triangle is 6 square units, a 20 × 10 room with an 8 × 4 corner taken out is 168.
On top of those, property tests run each formula against thousands of random inputs and check statements that must hold for every one of them:
- an area is never negative and never NaN, whatever the input;
- scaling a room by k scales its area by k²;
- converting a length to another unit and back returns the original;
- the drawing agrees with the answer — the outline drawn on screen is measured with the polygon formula, and its area must equal the area the calculator reports.
That last one is the reason the diagrams can be trusted as drawings rather than decoration: a room that draws differently from the way it calculates fails the build.
Measuring a whole house (ANSI Z765)
The house calculator follows ANSI Z765, the square-footage method Fannie Mae has required for appraisals with effective dates from 1 April 2022. These are the rules it applies, and where each was read:
| Rule | As applied here |
|---|---|
| Finished area needs a ceiling of 7 ft (2.13 m); 6 ft 4 in (1.93 m) under beams, ducts and other obstructions; no requirement under stairs | A room with a flat ceiling below the height is reported separately, as nonstandard finished area |
| Where the ceiling slopes, at least half of the room must be 7 ft or higher, and no part under 5 ft (1.52 m) counts | The part under 5 ft is deducted first; if less than half of what remains is at full height, the whole room is reported separately rather than counted |
| Above-grade finished area is the sum of finished areas on levels entirely above grade; below-grade finished area is the sum on levels wholly or partly below grade | The two are shown separately and never added |
| “No statement of a house’s finished square footage can be made without the clear and separate distinction of above-grade areas and below-grade areas” | The summary refuses to print one total |
| Openings to the floor below are not counted; stair treads and landings descending through them count on the floor they descend from, up to the area of the opening | Entered per space, applied exactly |
| Garages and unfinished areas are not finished square footage; areas not connected to the house through finished space are not either | Listed separately with the reason |
| A finished area attached to the house with no direct access from inside it is noncontinuous finished area (Fannie Mae’s ANSI FAQ, Q18) | Listed on a line of its own, apart from the totals and from the nonstandard rooms |
| Measured at floor level to the exterior finished surface of the outside walls (detached), or to the centrelines between houses where appropriate (attached) | Said on the page; the figures you type are assumed to be measured that way |
| Reported to the nearest whole square foot, or the nearest 0.1 m² in SI units | Rounded once, at the end |
Where these came from, and what is missing. The official copy of ANSI Z765-2021 (Home Innovation Research Labs, USD 25) has not been bought. The rules above were read in Fannie Mae’s Selling Guide B4-1.3-05, which requires the standard and restates parts of it, and in a published slide deck from an Appraisal Institute chapter that reproduces the standard’s own wording, including its section numbering for rounding and reporting (PDF, opened 22 September 2026). A copy of the standard hosted by an MLS was found but is an encrypted PDF, and we did not try to open it. Since 11 October 2026 the rules have also been checked against Fannie Mae’s ANSI FAQ (September 2025) and the standard’s free public draft of February 2020, which Home Innovation says the 2021 edition changed mainly in its commentary; the house square footage guide lists every source.
Until the official copy is read, treat this page as what it is: a careful implementation of a standard we have read about rather than read. An appraisal that has to cite the standard should be checked against the standard.
What this calculator does not do yet
- The official text of ANSI Z765. The house calculator above is built from sources that restate the standard, not from the standard itself. That is the next thing to fix on this page.
- Other national standards. Germany’s Wohnflächenverordnung and France’s Loi Carrez decide living area differently again — a balcony usually at a quarter of its area and at most half, a minimum height of 1.80 m — and each needs its own mode rather than an approximation of one. They are planned with those languages.
- What holds a deck or a roof up. The deck and roof pages count what goes on the frame, not the frame: joist, beam and rafter sizes, posts and footings come from span tables and the building code where you build, and are for your plans.
- Land units outside South Asia. Tsubo, ping, dunam and the rest need per-region values with the government document each was read from, the way the South Asian units above do.
Corrections
If a number here is wrong, that is a bug and it will be fixed. Write to contact@sqftmath.com with the page and the measurement you used, and the correction will be dated when it ships.