About this tool
Work out exactly how many lines or branches you must cover to hit a coverage threshold, with new-code rules and a sprint ratchet plan.
This calculator converts a percentage coverage threshold into the exact whole number of lines, branches, statements or functions you must cover — using ceil(total × target / 100), the same arithmetic every coverage gate applies. It is for developers and leads staring at an Istanbul, JaCoCo, coverage.py or SimpleCov report who need to know how many items stand between the current number and a green build, what the next pull request has to achieve, and how to ratchet the gate up over several sprints.
Open Test Coverage Target Calculator on AltFTool — it loads instantly in your browser.
Enter the values you already know.
Fine-tune the options to match your scenario.
Read the result and use it in your planning or reporting.
Percentages hide the real unit — this returns the exact count of lines or branches to cover, using the ceiling a gate actually enforces.
Shows how well the code in your next change must be covered, and when the gate is unreachable without touching existing code.
Splits a coverage increase into equal percentage-point steps with the item count each sprint owes.
Multiply the total lines by 0.80 and round up: required = ceil(total × 80 / 100), then subtract the lines already covered. For 1,000 total lines with 750 covered, you need ceil(800) = 800 covered lines, so 50 more — rounding down would leave you at 79.9% and a failing gate.
Because coverage gates compare the exact ratio against the threshold, not a rounded display value — 79.99 is less than 80, so the check fails. That is why this calculator uses a ceiling: covering even one line fewer than ceil(total × target / 100) still fails the build.
Yes, if the new code ships untested — it grows the denominator while the covered count stays the same. Adding 100 untested lines to a 1,000-line project at 75% drops coverage to 750/1,100 ≈ 68.2%, and the required covered count for an 80% gate rises from 800 to 880.
A ratchet raises the coverage threshold in small scheduled steps — for example two percentage points per sprint — instead of one large jump, so each sprint owes a fixed, achievable number of newly covered lines. It prevents the common failure mode where an ambitious one-off target (say 70% to 90%) stalls and the gate gets disabled.
Add the Test Coverage Target Calculatorwidget to your blog or website — free, responsive, no signup. Just keep the “Widget by AltFTool” credit link visible.
<iframe src="https://www.altftool.com/embed/widget/test-coverage-target-calculator"
title="Test Coverage Target Calculator — free AltFTool widget"
width="100%" height="640" style="border:0;border-radius:12px;overflow:hidden"
loading="lazy" referrerpolicy="no-referrer-when-downgrade"></iframe>
<p style="font-size:12px;margin:4px 0 0">Widget by <a href="https://www.altftool.com/tools/all/test-coverage-target-calculator?utm_source=embed&utm_medium=widget">AltFTool — free online tools</a></p>