# The construction quantity formulas, with the vectors that pin them

> The equations behind the site's quantity calculators — volume, coverage, spacing, bulking, stairs, pitch — each pinned to registry test vectors.

Page: https://craftquantities.com/formulas/ (formula reference). This is the page's Markdown copy; the HTML page is the canonical version.

Each equation below is the one the site's calculators run, written once in plain notation and MathML, with its symbols and units in both systems, the calculators that use it, the sources they cite and the test vectors that hold it to the code.

- 28 Formulas
- 8 Formula families
- 87 Test vectors that agree

- Browse the families
- [The index (JSON)](https://craftquantities.com/formulas/index.json)

The families

## 8 families of equations

Grouped by what they answer. Each page states its equations, defines every symbol and lists the vectors.

- ### [Volume from geometry](https://craftquantities.com/formulas/volume-from-geometry/)

  Most volumes on a site are a box or a round column: a slab, a trench, a bed of topsoil, a pier poured in a tube. Two equations cover them, and every figure below comes from a calculator that runs them.

  Formulas in this family

  - [Rectangular prism](https://craftquantities.com/formulas/volume-from-geometry/#rectangular-prism-volume)`V = L × W × D`
  - [Cylinder](https://craftquantities.com/formulas/volume-from-geometry/#cylinder-volume)`V = π × (d / 2)² × h`
- ### [Area of plane shapes](https://craftquantities.com/formulas/area-of-plane-shapes/)

  An irregular floor plan, a round patio or a gable end is measured by breaking it into rectangles, circles and triangles and adding their areas. These are the three equations, as the area calculator runs them.

  Formulas in this family

  - [Rectangle](https://craftquantities.com/formulas/area-of-plane-shapes/#rectangle-area)`A = L × W`
  - [Circle](https://craftquantities.com/formulas/area-of-plane-shapes/#circle-area)`A = (π × d²) / 4`
  - [Triangle](https://craftquantities.com/formulas/area-of-plane-shapes/#triangle-area)`A = (b × h) / 2`
- ### [Coverage, spread rate and waste](https://craftquantities.com/formulas/coverage-and-spread-rate/)

  A liquid finish is bought by the area it covers per litre or gallon, a sheet or a unit by how many go into a square metre or foot, and every order carries an allowance for waste. All three reduce to the area times a rate, then a percentage on top.

  Formulas in this family

  - [Quantity from a spread rate](https://craftquantities.com/formulas/coverage-and-spread-rate/#spread-rate-quantity)`Q = (A × n) / s`
  - [Pieces from a rate per area](https://craftquantities.com/formulas/coverage-and-spread-rate/#pieces-per-area)`N = A × k`
  - [Quantity with a waste allowance](https://craftquantities.com/formulas/coverage-and-spread-rate/#quantity-with-waste)`Q = Q₀ × (1 + w / 100)`
- ### [Spacing and count](https://craftquantities.com/formulas/spacing-and-count/)

  Studs, joists, posts and balusters are counted the same few ways: from the centres they stand at, or from the largest gap a rule allows, and then spaced so every gap is equal.

  Formulas in this family

  - [Members on centres](https://craftquantities.com/formulas/spacing-and-count/#count-on-centres)`n = ⌈L / s⌉ + 1`
  - [Members under a maximum gap](https://craftquantities.com/formulas/spacing-and-count/#count-under-a-maximum-gap)`n = ⌈(L − g_max) / (w + g_max)⌉`
  - [Equal gap between members](https://craftquantities.com/formulas/spacing-and-count/#equal-gap-between-items)`g = (L − n × w) / (n + 1)`
- ### [Bulking, compaction and weight](https://craftquantities.com/formulas/bulking-and-compaction/)

  Soil, rubble and aggregate have three volumes, in the ground, on the truck and placed and rolled, and they are sold by weight. The equations below convert between the volumes with a percentage or a factor, and from volume to mass with a density.

  Formulas in this family

  - [Loose volume from swell](https://craftquantities.com/formulas/bulking-and-compaction/#loose-volume-from-swell)`V_L = V_B × (1 + s / 100)`
  - [Compacted volume from shrinkage](https://craftquantities.com/formulas/bulking-and-compaction/#compacted-volume-from-shrinkage)`V_C = V_B × (1 + c / 100)`
  - [Bulked volume from a factor](https://craftquantities.com/formulas/bulking-and-compaction/#bulked-volume-from-factor)`V_L = F × V_B`
  - [Mass from volume and density](https://craftquantities.com/formulas/bulking-and-compaction/#mass-from-volume-and-density)`m = V × ρ`
- ### [Stair geometry](https://craftquantities.com/formulas/stairs/)

  A straight flight is set out from one measurement, floor to floor, and one choice, a target riser. Everything else follows: how many risers, how tall each one is, and the going that makes them comfortable.

  Formulas in this family

  - [Number of risers](https://craftquantities.com/formulas/stairs/#riser-count)`n = max(1, round(H / rₜ))`
  - [Actual riser height](https://craftquantities.com/formulas/stairs/#riser-height)`R = H / n`
  - [Going from the comfort rule](https://craftquantities.com/formulas/stairs/#comfort-going)`G = c − 2 × R`
- ### [Roof pitch, slope and diagonals](https://craftquantities.com/formulas/roof-pitch-and-slope/)

  A slope is written three ways on site, as a pitch of rise per 12 of run, a grade in per cent or an angle, and every one of them is a right triangle. The equations convert between them, give the length along the slope and the diagonal that proves a corner square.

  Formulas in this family

  - [Pitch to angle](https://craftquantities.com/formulas/roof-pitch-and-slope/#pitch-to-angle)`θ = arctan(x / 12)`
  - [Grade in per cent](https://craftquantities.com/formulas/roof-pitch-and-slope/#grade-percent)`p = 100 × (Δh / L)`
  - [Slope angle](https://craftquantities.com/formulas/roof-pitch-and-slope/#slope-angle)`θ = arctan(Δh / L)`
  - [Common rafter length](https://craftquantities.com/formulas/roof-pitch-and-slope/#common-rafter-length)`Lᵣ = (B / 2 + o) × √(1 + (x / 12)²)`
  - [Diagonal of a rectangle](https://craftquantities.com/formulas/roof-pitch-and-slope/#diagonal-of-a-rectangle)`d = √(a² + b²)`
- ### [Unit conversions](https://craftquantities.com/formulas/unit-conversions/)

  Most construction conversions are exact by definition: the foot has been 0.3048 m since 1959, and every area and volume factor follows from it. These are the factors the converters multiply by.

  Formulas in this family

  - [Feet to metres](https://craftquantities.com/formulas/unit-conversions/#feet-to-metres)`y = 0.3048 × x`
  - [Feet to inches](https://craftquantities.com/formulas/unit-conversions/#feet-to-inches)`y = 12 × x`
  - [Cubic yards to cubic metres](https://craftquantities.com/formulas/unit-conversions/#cubic-yards-to-cubic-metres)`y = 0.764554857984 × x`
  - [Pounds to kilograms](https://craftquantities.com/formulas/unit-conversions/#pounds-to-kilograms)`y = 0.45359237 × x`
  - [Fahrenheit to Celsius](https://craftquantities.com/formulas/unit-conversions/#fahrenheit-to-celsius)`T_C = (T_F − 32) × (5 / 9)`

How the library is made

## Generated from the calculators, checked against them

No equation here is copied from a page. Each is written once as an expression, and that one expression is drawn as MathML, printed in plain notation, exported in the JSON and evaluated. For every calculator that uses it, a binding says which inputs, breakdown lines or result feed each symbol.

Every build runs each bound calculator's pinned test vectors through its own compute function and through the equation. A vector is published only where the two agree to a millionth, and the test suite fails if any bound vector disagrees, so an equation cannot stay on this page after the code beneath it changes.

The citations are each calculator's own sources, word for word. Where a calculator cites a code or a manufacturer, the library repeats that citation; it adds none of its own.

26 calculators run these equations, and 87 of their test vectors agree with them. [How the site verifies its calculators](https://craftquantities.com/verification/)

Machine-readable

## Every family as a JSON file

One file per family at /formulas/<family>.json, and an index at /formulas/index.json. Plain static files: no key, no rate limit.

**id**

The formula's stable identifier. It never changes; a revised equation gets a new id.

**expression**

The right-hand side in infix notation, with the operators and functions each file lists under expressionSyntax.

**inputs / output**

Each symbol with its meaning and its unit in the metric and the imperial column.

**testVectors**

Inputs, the formula's output, and what the calculator's compute function returned for the same vector.

**calculators**

The calculators that run the equation, and which of their outputs it reproduces.

[https://craftquantities.com/formulas/index.json](https://craftquantities.com/formulas/index.json)

- [/formulas/volume-from-geometry.json](https://craftquantities.com/formulas/volume-from-geometry.json)
- [/formulas/area-of-plane-shapes.json](https://craftquantities.com/formulas/area-of-plane-shapes.json)
- [/formulas/coverage-and-spread-rate.json](https://craftquantities.com/formulas/coverage-and-spread-rate.json)
- [/formulas/spacing-and-count.json](https://craftquantities.com/formulas/spacing-and-count.json)
- [/formulas/bulking-and-compaction.json](https://craftquantities.com/formulas/bulking-and-compaction.json)
- [/formulas/stairs.json](https://craftquantities.com/formulas/stairs.json)
- [/formulas/roof-pitch-and-slope.json](https://craftquantities.com/formulas/roof-pitch-and-slope.json)
- [/formulas/unit-conversions.json](https://craftquantities.com/formulas/unit-conversions.json)

The text and the data of the formula library are published under the Creative Commons Attribution 4.0 licence (CC BY 4.0): reuse them, in any medium and for any purpose, with a credit to Craft Quantities and a link to the page.

These are quantity equations, not design checks. Nothing here sizes a member or confirms that a structure is safe; that is for the engineer or building official responsible for the work.

---
Source: https://craftquantities.com/formulas/
Craft Quantities: free to read, cite and link to; the pages are not licensed for republication. Quantities only: no prices, no design and no certification.
