Dirt Calculator – Calculate Soil Required in Kg

Dirt Calculator

Dirt Calculator

Created by Team y2calculate

Content written by Noman  (Civil engineer)

Coding and design by Marcelino (Ms computer science)

Reviewed by Wahid and Anneliese

Fact checked 🔍✓

Published: November 23, 2023 → Last Updated: January 21, 2024

Table of Contents

Gardening and landscaping projects often require precise calculations to determine the amount of soil needed. Whether you’re planning a new garden bed or embarking on a landscaping project, having an accurate estimate of the required soil volume and weight is crucial. The Dirt Calculator presented here offers a user-friendly solution to simplify these calculations.

Soil required per unit volume

The weight of 1 cubic meter of soil can vary depending on the type of soil and its moisture content. However, as a general estimate, 1 cubic meter of moderately damp soil weighs approximately 1,300 to 1,700 kilograms (kg).

Here is a table of the approximate weight of 1 cubic meter of different types of soil:

Soil TypeApproximate Weight (kg/m³)
Sandy soil1,200 – 1,400
Loam soil1,300 – 1,500
Clay soil1,500 – 1,700

Calculation Methodology

The Dirt Calculator employs a straightforward yet comprehensive approach to determine the amount of soil needed for your gardening or landscaping project. The calculations involve three primary steps:

Volume Calculation:

The volume of soil required is calculated by multiplying the width, length, and depth of the specified area.


\[ V = \text{{Width}} \times \text{{Length}} \times \text{{Depth}} \]

Soil Weight Calculation:

The weight of the soil is estimated based on the selected soil type, considering a range for each soil type.


\[ W = V \times \left( \frac{{\text{{Min Soil Weight}} + \text{{Max Soil Weight}}}}{2} \right) \]

Bag Estimation:

The total weight is translated into the number of 5kg bags required for practicality.


\[ \text{{Bags Required}} = \lceil \frac{W}{5} \rceil \]

Copy and paste the below code into HTML editor on article or website

  Users are not allowed to edit any part of the calculator except the CSS.
  They are only allowed to edit the CSS to achieve their desired style.

<!DOCTYPE html>
<html lang="en">

    /* CSS styling */
    .calculator {
      background-color: #f5f5f5;
      border-radius: 10px;
      padding: 1px;
      max-width: 400px;
      margin: 0 auto;
      font-family: Arial, sans-serif;

    .calculator h1 {
      color: #4CAF50;
      text-align: center;

    .calculator label {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-top: 10px;

    .calculator input[type="number"],
    .calculator select {
      width: calc(50% - 5px);
      padding: 8px;
      font-size: 14px;
      margin-bottom: 10px;
      border: 1px solid #ccc;
      border-radius: 4px;

    .calculator .calculate-btn {
      background-color: #4CAF50;
      color: #ffffff;
      border: none;
      padding: 10px 20px;
      font-size: 16px;
      border-radius: 4px;
      cursor: pointer;
      width: 100%;

    /* Adjusted style for the result class */
    .calculator .result {
      text-align: center;
      margin-top: 1px;
      margin-bottom: 1px;
      font-size: 13.5px; /* Adjusted font size */
      color: #333333;
      font-weight: bold;
      font-family: 'Roboto', sans-serif; /* Added font family */

    /* Terms of Use styling */
    .terms-of-use {
      font-size: 12px;
      color: #777;
      margin-top: 10px;

    .powered-by {
      font-size: 12px;
      color: #777;
      margin-top: 10px;
  <!-- Link to Roboto font from Google Fonts -->
  <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Roboto:wght@400&display=swap">


  <div class="calculator">
    <h1>Dirt Calculator</h1>

    <label for="width">Width:
      <input type="number" id="width" placeholder="Enter the width" required>
      <select id="widthUnit">
        <option value="m">meters</option>
        <option value="cm">centimeters</option>
        <option value="ft">feet</option>
        <option value="inches">inches</option>
        <option value="mm">millimeters</option>

    <label for="length">Length:
      <input type="number" id="length" placeholder="Enter the length" required>
      <select id="lengthUnit">
        <option value="m">meters</option>
        <option value="cm">centimeters</option>
        <option value="ft">feet</option>
        <option value="inches">inches</option>
        <option value="mm">millimeters</option>

    <label for="depth">Depth:
      <input type="number" id="depth" placeholder="Enter the depth" required>
      <select id="depthUnit">
        <option value="m">meters</option>
        <option value="cm">centimeters</option>
        <option value="ft">feet</option>
        <option value="inches">inches</option>
        <option value="mm">millimeters</option>

    <label for="soilType">Soil Type:
      <select id="soilType">
        <option value="sandy">Sandy soil</option>
        <option value="loam">Loam soil</option>
        <option value="clay">Clay soil</option>

    <button class="calculate-btn" onclick="calculateDirt()">Calculate Dirt</button>
    <div class="result" id="result"></div>
    <div class="result" id="totalWeight"></div>
    <div class="result" id="bagsRequired"></div>

    <div class="powered-by">
      Powered by <a href="https://y2calculate.com/dirt-calculator-calculate-soil-required-in-kg/" target="_blank">y2calculate</a>

    function calculateDirt() {
      var width = parseFloat(document.getElementById("width").value);
      var widthUnit = document.getElementById("widthUnit").value;
      var length = parseFloat(document.getElementById("length").value);
      var lengthUnit = document.getElementById("lengthUnit").value;
      var depth = parseFloat(document.getElementById("depth").value);
      var depthUnit = document.getElementById("depthUnit").value;
      var soilType = document.getElementById("soilType").value;

      // Convert dimensions to meters
      width = convertToMeters(width, widthUnit);
      length = convertToMeters(length, lengthUnit);
      depth = convertToMeters(depth, depthUnit);

      // Calculate volume of dirt
      var volume = width * length * depth;

      // Calculate total weight of soil based on soil type (kg/m³)
      var soilWeightRange = getSoilWeightRange(soilType);
      var totalWeight = volume * ((soilWeightRange.min + soilWeightRange.max) / 2); // Assuming the average of the range

      // Calculate number of 5kg bags required
      var bagsRequired = Math.ceil(totalWeight / 5);

      // Display the calculated volume, total weight, and bags required
      document.getElementById("result").innerHTML = "You will need " + volume.toFixed(2) + " cubic meters of dirt.";
      document.getElementById("totalWeight").innerHTML = "Total weight of soil: " + totalWeight.toFixed(2) + " kg.";
      document.getElementById("bagsRequired").innerHTML = "Number of 5kg bags required: " + bagsRequired;

    function convertToMeters(value, unit) {
      if (unit === 'cm') {
        return value * 0.01; // 1 centimeter = 0.01 meters
      } else if (unit === 'ft') {
        return value * 0.3048; // 1 foot = 0.3048 meters
      } else if (unit === 'inches') {
        return value * 0.0254; // 1 inch = 0.0254 meters
      } else if (unit === 'mm') {
        return value * 0.001; // 1 millimeter = 0.001 meters
      } else {
        return value; // Already in meters or unknown unit

    function getSoilWeightRange(soilType) {
      // Return weight range based on soil type (kg/m³)
      switch (soilType) {
        case 'sandy':
          return { min: 1200, max: 1400 };
        case 'loam':
          return { min: 1300, max: 1500 };
        case 'clay':
          return { min: 1500, max: 1700 };
          return { min: 0, max: 0 }; // Default to 0 if unknown soil type



Leave a Reply