concrete-calculator
v1.0.1
Published
Calculate concrete volume, bags, and costs for slabs, cylinders, footings, stairs, and custom shapes. Supports cubic yards, cubic meters, and bag estimates.
Maintainers
Readme
concrete-calculator
Lightweight, zero-dependency concrete volume, bag, and cost calculator for JavaScript and TypeScript.
Calculate how much concrete you need for slabs, cylinders, footings, stairs, curbs, and more — in cubic feet, cubic yards, or number of bags.
Built by SlabCalc.co — free online concrete calculators for contractors, DIYers, and engineers.
Install
npm install concrete-calculatorQuick Start
import { estimate } from 'concrete-calculator';
// 10 × 12 ft slab, 4 inches thick
const result = estimate(
{ length: 10, width: 12, thickness: 4 / 12 },
{ wasteFactor: 1.1 } // 10% waste allowance
);
console.log(result);
// {
// cubicFeet: 44,
// cubicYards: 1.63,
// bags: 74, (80 lb bags)
// bagCost: 481, (at $6.50/bag)
// readyMixCost: 244.44 (at $150/yard)
// }Shapes
All shape functions accept dimensions in any consistent unit and return volume in that unit cubed.
import { slab, cylinder, footing, stairs, curb, hollowCylinder } from 'concrete-calculator';
// Rectangular slab: length × width × thickness
slab(20, 10, 0.33); // 66 cu ft
// Cylinder / sonotube: diameter, height
cylinder(2, 4); // 12.57 cu ft
// Continuous footing: length × width × depth
footing(40, 1.5, 1); // 60 cu ft
// Staircase: risePerStep, runPerStep, width, numberOfSteps
stairs(7/12, 11/12, 3, 5); // solid volume for 5 steps
// Curb: length × width × height
curb(100, 0.5, 0.5); // 25 cu ft
// Hollow cylinder: outerDiameter, innerDiameter, height
hollowCylinder(4, 3, 5); // ring volumeNeed an interactive version? Try the Concrete Slab Calculator or the Concrete Column Calculator at SlabCalc.co.
Unit Conversions
import { cubicFeetToYards, cubicYardsToCubicFeet, cubicFeetToMeters, cubicMetersToYards } from 'concrete-calculator';
cubicFeetToYards(54); // 2
cubicYardsToCubicFeet(2); // 54
cubicFeetToMeters(35.31); // ≈ 1
cubicMetersToYards(1); // ≈ 1.31Bag Estimation
Estimate pre-mixed concrete bags (Quikrete, Sakrete, etc.) needed for your project.
import { bagEstimate, bagsFromYards } from 'concrete-calculator';
// 50 cu ft with 80 lb bags
bagEstimate(50, 80); // 84 bags
// 1 cubic yard with 60 lb bags
bagsFromYards(1, 60); // 60 bags
// Supported bag sizes: 40, 50, 60, 80 (lbs)Learn more about how many bags of concrete you need on SlabCalc.co.
Cost Estimation
import { readyMixCost, bagCost } from 'concrete-calculator';
// Ready-mix truck delivery
readyMixCost(3, 150); // { yards: 3, cost: 450, shortLoad: false }
// With short-load fee ($100 under 1 yard)
readyMixCost(0.5, 150, 100, 1); // { yards: 0.5, cost: 175, shortLoad: true }
// Bagged concrete cost
bagCost(50, 80, 6.50); // { bags: 84, cost: 546 }See the full Concrete Cost Calculator for a detailed breakdown including delivery fees, labor, and rebar.
All-in-One Estimate
The estimate() function gives you everything at once for a rectangular slab:
import { estimate } from 'concrete-calculator';
const result = estimate(
{ length: 20, width: 10, thickness: 6 / 12 },
{
wasteFactor: 1.1, // 10% extra (default)
bagSize: 80, // 80 lb bags (default)
pricePerBag: 6.50, // per bag (default)
pricePerYard: 150, // ready-mix price (default)
}
);For more complex projects, use the interactive Concrete Slab Calculator at SlabCalc.co — it handles rebar spacing, sub-base depth, and generates full material lists.
TypeScript
Full type definitions are included out of the box.
import { estimate, slab, bagEstimate } from 'concrete-calculator';
// All functions are fully typed — no @types package needed.Common Concrete Projects
| Project | Calculator | |---------|-----------| | Patio or driveway slab | Slab Calculator | | Deck or fence post footings | Footing Calculator | | Round columns / sonotubes | Column Calculator | | Steps and stairs | Stairs Calculator | | Retaining walls | Wall Calculator | | Curbs and gutters | Curb Calculator |
License
MIT — see LICENSE.
SlabCalc.co — Free concrete calculators, guides, and cost estimators for your next project.
