Test Coverage Target Calculator
How many lines are missing to hit your coverage target, how many of a PR's new lines need tests to keep the gate green, and how much untested code still fits.
—
How many lines are missing for the coverage gate
A team with a coverage gate in CI keeps running into the same three sums. The first is straightforward: I am at 75%, the target is 80%, how many lines do I need to cover? The second turns up mid pull request and is far less obvious. And the third almost nobody does — it is the one that prevents the surprise of breaking the gate without having touched a single test.
The sum that misleads is the pull request one. Covering 80% of the new lines does not keep the total at 80%: if the base sits above that, there is slack and you can cover less; if it sits below, covering even 100% of the new lines does not recover it. Enter how many lines the PR adds and the page says how many of them need tests — and warns when the gate is unreachable from the PR alone, which is the case where the problem is the base rather than what you are writing.
The third sum answers how much untested code still fits before coverage falls below the gate. With 900 of 1000 lines covered and a gate at 80%, another 125 lines fit with no tests at all — after that, any line brings it down. All the arithmetic runs on integers: 80% of 1000 is exactly 800, and an implementation that rounds up would ask for 801, sending you to cover one line more than necessary.
Frequently asked questions
Does this work for lines, branches or statements?
Why does the PR requirement change with the base?
Does high coverage mean well-tested code?
Related Tools
Retirement Goal Monthly Contribution
Calculates monthly contribution to reach a retirement goal with compound interest.
Retirement Savings Goal
Find out how much to save each month to reach the amount you want for retirement within a set number of years. Plan your financial independence clearly.
Sales Commission Calculator
Compute sales commission with progressive targets: lower % until quota, higher % after. Shows commission and total earned.
Fabric Cover Factor
Compute a fabric's cover factor, CF = thread density (threads/cm) · √(Tex), an index of how 'closed' the weave is — how much the threads cover the area, leaving more or fewer open spaces. High factors indicate dense, opaque fabrics (canvas, twill); low ones, sheer, breathable fabrics (voile, mesh). It influences air permeability, opacity and strength. Enter the thread density and the count in Tex.
Car Savings Goal Calculator
Calculate how much to set aside each month to buy a car in cash within your chosen time frame. Reach the goal without paying loan interest.
Paint Calculator (Gallons)
Calculate how many gallons of paint you need for a wall or room, from the area and the coverage per gallon. Avoid buying too much or too little.
The results provided by this tool are for general informational and educational purposes only and do not constitute professional, financial, medical, legal, tax or accounting advice. Always confirm important decisions with a qualified professional and official sources.