Accuracy Calculator
Calculate accuracy from a confusion matrix using true positives, true negatives, false positives, and false negatives for quick model checks.
Enter the Details
Result will appear here...
What the accuracy calculator does
Accuracy is the share of all predictions that a classifier gets right. This calculator works it out from a confusion matrix, the counts of true positives, true negatives, false positives, and false negatives, and reports the accuracy along with sensitivity and specificity for a fuller picture.
Accuracy is the most natural single number for a classifier, but also one of the easiest to be misled by. Below is how it works and where it falls short.
How to use it
- Enter the four counts from your confusion matrix: true positives, false positives, true negatives, and false negatives.
- Press Calculate for the accuracy, sensitivity, and specificity, or Reset to clear it.
The confusion matrix
Every prediction a classifier makes falls into one of four boxes. A true positive is a real case correctly flagged, and a true negative is a real non-case correctly cleared. A false positive is a false alarm, flagging something that was not there, and a false negative is a miss, failing to flag something that was.
Laid out together, these four counts form the confusion matrix, and almost every measure of a classifier is built from them. The two correct boxes sit on one diagonal, the two mistakes on the other, and the balance between them is what the various performance measures each summarise in their own way.
How accuracy is worked out
Accuracy simply adds up the correct predictions and divides by the total number of predictions:
Accuracy = (true positives + true negatives) ÷ total predictions
So an accuracy of 0.94, or 94 percent, means the classifier was right on 94 of every 100 cases. It is easy to compute, easy to explain, and gives a quick overall sense of how often the classifier is correct. For many balanced problems, that is exactly the summary you want.
The accuracy paradox
Accuracy has a serious blind spot when one class is much rarer than the other, and it is worth understanding well. Imagine a disease that affects 1 in 100 people. A lazy test that simply declares everyone healthy, catching no cases at all, is still right 99 times out of 100, for an accuracy of 99 percent.
That 99 percent looks excellent, yet the test is useless, since it never finds a single case. This is the accuracy paradox: on imbalanced data, a high accuracy can hide total failure on the class that actually matters. The classifier scores well simply by always guessing the common answer, which is why accuracy alone can be dangerously reassuring when the important class is rare.
Why sensitivity and specificity come too
The cure for the paradox is to look past the single number, which is why this calculator also reports sensitivity and specificity. Sensitivity asks how many of the real cases were caught, and specificity asks how many of the real non-cases were cleared. The always-healthy test from above would score 100 percent specificity but zero sensitivity, and that zero exposes the failure the accuracy hid.
So accuracy is best read as a headline, not the whole story. When the classes are roughly balanced, accuracy is a fair summary on its own. When one class is rare, sensitivity and specificity tell you whether the classifier actually works on the cases you care about, or is merely riding the imbalance to a flattering score.
A worked example
Suppose a classifier produces 90 true positives, 850 true negatives, 50 false positives, and 10 false negatives, for 1,000 predictions in all. The accuracy is (90 plus 850) divided by 1,000 = 94 percent, a solid result on reasonably balanced data.
Contrast that with the paradox case: if 990 of 1,000 people are truly negative, a classifier that blindly answers negative every time scores 99 percent accuracy while catching none of the 10 real cases. The higher accuracy belongs to the worse classifier, which is the whole lesson. Checking sensitivity would immediately reveal the second one as useless, since it catches zero of the real positives.
Entering your values
Enter the four confusion-matrix counts as whole numbers. The calculator returns accuracy alongside sensitivity and specificity. Reading all three together is the safest habit, especially whenever one class is much larger than the other, where accuracy on its own can flatter to deceive.
Questions people ask
What is accuracy?
The share of all predictions a classifier gets right, the correct predictions divided by the total. It is the most natural single summary of performance.
What is the accuracy paradox?
On imbalanced data, a high accuracy can hide total failure on the rare class. A test that always guesses the common answer scores well while being useless.
Why look at sensitivity and specificity too?
Because they reveal how the classifier does on each class separately. They expose failures on a rare but important class that accuracy alone can conceal.
Is high accuracy always good?
Only when the classes are reasonably balanced. When one class is rare, check sensitivity and specificity before trusting a high accuracy.
References
A quick note on where the methods here come from. Classification performance measures and the confusion matrix are set out in the NIST/SEMATECH e-Handbook of Statistical Methods, the US government's public statistics reference. OpenStax Introductory Statistics is a free, widely used textbook covering proportions and the underlying probability.
- NIST/SEMATECH e-Handbook of Statistical Methods (classification and error rates). https://www.itl.nist.gov/div898/handbook/
- OpenStax, Introductory Statistics (proportions and probability). https://openstax.org/details/books/introductory-statistics-2e
Ankit Khatiwada is a researcher and graduate student in Computer Science at Saarland University, with strengths in statistics, data analysis, data engineering, and full stack development. His work sits at the intersection of quantitative reasoning and applied technology, making him a strong fit for tools that depend on clear numerical logic. At Eon Tools, he reviews number and statistical tools.
Other Tools
- A/B Test Calculator
- Beta Function Calculator
- Central Limit Theorem Calculator
- Chebyshev'S Theorem Calculator
- Constant Of Proportionality Calculator
- Empirical Rule Calculator
- Least To Greatest Calculator
- Pie Chart Calculator
- Point Estimate Calculator
- Sample Ratio Mismatch Calculator
- Venn Diagram Calculator
- Weighted Mean Calculator