Composting turns kitchen scraps, yard waste, and other organic materials into a dark, crumbly soil amendment. Microorganisms drive this process. They use carbon as their main energy source and nitrogen to build proteins and reproduce. If the balance between carbon and nitrogen is off, the pile slows down, smells, or fails to heat properly.
The balance is usually described as a carbon-to-nitrogen ratio (C:N). An overall ratio of about 25:1 to 30:1 by dry mass is often ideal for fast, hot composting. In practice this means mixing carbon-rich browns (dry leaves, straw, cardboard) with nitrogen-rich greens (fresh grass, food scraps, manures).
This calculator estimates how much green material you need to add to a known quantity of browns so that the blended mix lands close to your target C:N ratio.
A C:N ratio expresses how many parts of carbon there are for each part of nitrogen, by mass. For example, a ratio of 60:1 means 60 units of carbon for every 1 unit of nitrogen. When you combine two different materials, the total carbon is the sum of each material's carbon, and the total nitrogen is the sum of each material's nitrogen. The combined ratio is therefore:
(total carbon) / (total nitrogen) = (c1 + c2) / (n1 + n2).
Each material's carbon and nitrogen can be estimated from its C:N ratio and its mass. For a material with ratio R and mass m:
For your pile, the calculator treats:
From the relationships above, we can solve algebraically for the required mass of greens. The resulting formula used in the script is:
M2 = (T · N1 − C1) ÷ [ (R2 − T) / (R2 + 1) ]
This gives the amount of green material needed, based on your browns, to get as close as possible to the target ratio T.
The results panel under the form will display two key outputs:
If the calculator reports that the target ratio is not achievable with the given materials, it usually means the green material is not nitrogen-rich enough (its C:N ratio is too high) to pull the overall blend down to your chosen target. In that case, try one of these adjustments:
Remember that a range of about 25–35:1 is usually acceptable. Hitting 30:1 exactly is not necessary for successful composting; this tool is there to guide your mix rather than prescribe a precise recipe.
Imagine you have 20 kg of straw with an approximate C:N of 80:1, and you want an overall pile close to 30:1 using grass clippings at 15:1 as your green material.
The calculator will estimate that you should add about 14.8 kg of green material. Your total mix mass would be roughly 34.8 kg. This blend brings the pile into a good range for active composting, assuming moisture and aeration are also adequate.
| Material | Approximate C:N ratio | Notes |
|---|---|---|
| Dry leaves | 50–80:1 | Varies by tree species and how decomposed they are. |
| Straw | 60–80:1 | Good structural brown; can be slow to break down if not shredded. |
| Cardboard / paper | 150–350:1 | Very carbon rich; shred and mix well to avoid mats. |
| Fresh grass clippings | 15–20:1 | Wet, nitrogen-rich; can cause odors if used in thick layers. |
| Vegetable food scraps | 15–25:1 | Moderately green; mix with plenty of browns to deter pests. |
| Manure (varies by animal) | 10–20:1 | Often quite nitrogen rich; handle safely and cover in the pile. |
Even if you dial in the perfect C:N ratio on paper, your compost may still stall if basic physical conditions are not right.
This tool is designed as a practical guide, not a laboratory instrument. Keep these assumptions in mind when interpreting the results:
Use the calculator to get into a good starting range, then watch how your pile behaves. Warmth, steady volume loss, and an earthy smell are signs you are on track. If not, adjust by adding a bit more green or brown material, correcting moisture, and turning as needed.