construction-utilsConstruction calculation utilities for building projects — measurements, materials, lumber, drywall, paint, roofing, slope, and cost estimation helpers.
Part of the www.slabcalc.co ecosystem. For concrete-specific calculations, see the concrete-calculator package or the online Concrete Slab Calculator .
Installnpm install construction-utils Quick Startimport { squareFootage, drywallSheets, paintGallons, addMarkup } from "construction-utils" ;
const area = squareFootage ( 20 , 15 ) ;
const sheets = drywallSheets ( area) ;
const gallons = paintGallons ( area, 2 ) ;
const price = addMarkup ( sheets * 12 , 15 ) ; API Reference Measurements
Function
Description
squareFootage(length, width)
Area in sq ft
perimeter(length, width)
Perimeter in linear ft
circleArea(diameter)
Area of a circle
triangleArea(base, height)
Area of a triangle
roofArea(length, width, pitchRise?)
Roof area adjusted for pitch
Construction Math
Function
Description
gradePercent(rise, run)
Slope as percentage
roofPitch(rise, run?)
Pitch string (e.g., "6:12")
angleFromSlope(percent)
Degrees from slope %
slopeFromAngle(degrees)
Slope % from degrees
hypotenuse(rise, run)
Rafter/stringer length
Lumber
Function
Description
boardFeet(thickness, width, length)
Board feet for pricing
studsNeeded(wallLength, spacing?)
Stud count (default 16″ OC)
plateLength(wallLength, double?)
Linear ft of plates
Drywall
Function
Description
drywallSheets(sqft, waste?)
4×8 sheets needed (default 10% waste)
jointCompound(sqft)
Gallons of mud
drywallTape(sqft)
Feet of tape
Paint
Function
Description
paintGallons(sqft, coats?, coverage?)
Gallons needed (default 400 sqft/gal)
primerGallons(sqft, coverage?)
Primer gallons (default 300 sqft/gal)
Flooring
Function
Description
flooringSqft(length, width, waste?)
Material sq ft with waste factor
tileBoxes(sqft, sqftPerBox?)
Number of tile boxes
Insulation
Function
Description
insulationBatts(sqft, sqftPerBundle?)
Batt bundles needed
Unit Conversions
Function
Description
feetToMeters(ft) / metersToFeet(m)
Length conversion
inchesToCm(in) / cmToInches(cm)
Length conversion
sqftToSqm(sqft) / sqmToSqft(sqm)
Area conversion
psfToKpa(psf) / kpaToPsf(kpa)
Pressure conversion
Pricing Helpers
Function
Description
addMarkup(cost, percent)
Apply markup
tax(subtotal, percent)
Tax amount
totalWithTax(subtotal, percent)
Subtotal + tax
unitCost(total, qty)
Per-unit cost
bulkDiscount(qty, tiers, unitPrice)
Tiered bulk pricing
Namespace ImportsGroup functions by category:
import { measurements, lumber, drywall, paint, pricing } from "construction-utils" ;
const area = measurements. squareFootage ( 20 , 15 ) ;
const bf = lumber. boardFeet ( 2 , 6 , 8 ) ;
const sheets = drywall. drywallSheets ( area) ;
const gallons = paint. paintGallons ( area, 2 ) ;
const total = pricing. totalWithTax ( 500 , 8.25 ) ; Common Projects
Project
Functions to use
Frame a wall
studsNeeded(), plateLength(), boardFeet()
Hang drywall
drywallSheets(), jointCompound(), drywallTape()
Paint a room
squareFootage(), paintGallons(), primerGallons()
Install flooring
flooringSqft(), tileBoxes()
Estimate roof
roofArea(), roofPitch(), hypotenuse()
Grade a driveway
gradePercent(), angleFromSlope()
Bid a job
addMarkup(), totalWithTax(), bulkDiscount()
For concrete work — slabs, footings, cylinders, stairs — use the Concrete Slab Calculator or the concrete-calculator npm package.
TypeScriptFull type declarations included — zero config needed.
import { boardFeet, type BulkDiscountResult } from "construction-utils" ;
LicenseMIT — SlabCalc.co