Test Coverage Calculator

Calculate line, branch, or function coverage and see where it falls against a common industry heuristic. Free, no signup.

This free test coverage calculator turns your covered and total counts into a line, branch, or function coverage percentage, then shows where that number lands against a common industry heuristic. No signup, and your inputs never leave your browser.

Try a preset

The test coverage formula

Test coverage is the share of your code exercised by tests, written as a percentage:

Coverage % = (covered items ÷ total items) × 100

What counts as an item depends on the coverage type you pick: executable lines, branches (decision outcomes), or functions. The calculator applies the same formula to whichever you choose, so you can compare the three side by side.

Line, branch, and function coverage

  • Line coverage is the percentage of executable lines run by at least one test. It is the most common and the easiest to inflate.
  • Branch coverage is the percentage of decision outcomes (each side of every if, switch, or ternary) that a test exercises. It is stricter than line coverage and catches untested edge paths.
  • Function coverage is the percentage of functions or methods called at least once. It is a coarse signal of what has been touched at all.

How to use this calculator

  1. Pick the coverage type you are measuring: line, branch, or function.
  2. Enter the number of covered items and the total items from your coverage report.
  3. Read the resulting percentage and the band it falls into.

Nothing is uploaded; the math runs entirely in your browser.

What is a good test coverage percentage?

There is no universal target. A widely cited heuristic popularized by Google's testing teams treats roughly 60% as acceptable, 75% as commendable, and 90% as exemplary, while warning that chasing 100% is usually not worth it. Coverage tells you what was executed, not whether the assertions behind it are meaningful, so a high number on weak tests is worse than a lower number on strong ones. Use coverage as a floor and a trend, not a goal in itself.

Frequently asked questions

How do you calculate test coverage?

Divide the number of covered items by the total number of items and multiply by 100. For line coverage that is covered lines ÷ total lines × 100; the same formula applies to branches or functions.

What is a good test coverage percentage?

It depends on the code’s risk. A common heuristic treats about 75% as commendable and about 90% as exemplary, but coverage measures execution, not assertion quality, so context matters more than any single target.

What is the difference between line, branch, and function coverage?

Line coverage counts executable lines run, branch coverage counts decision outcomes exercised (both sides of each condition), and function coverage counts functions called at least once. Branch coverage is the strictest of the three.

Is 100% test coverage worth it?

Rarely. The last few percent often cost more than the bugs they catch, and 100% line coverage still says nothing about whether your assertions are correct. Most teams target a healthy band and focus effort on high-risk code.

Does this calculator store my numbers?

No. The calculation runs entirely in your browser. Nothing is sent to a server or saved.