Accuracy Calculator - Classification accuracy from confusion matrix counts
Use this accuracy calculator to enter the four confusion matrix counts and see how often a classifier was right, with sensitivity and specificity so an imbalanced dataset cannot hide behind a single percentage.
Accuracy Calculator
Results
What an Accuracy Score Measures
An accuracy calculator turns a confusion matrix into a single percentage when you ask one question: of every prediction the model made, how many were right? In a classification task the four outcomes are true positives, false negatives, false positives, and true negatives. Drop those counts into the tool and it returns the accuracy along with sensitivity and specificity so you can judge the result instead of just nodding at a number.
- • Binary medical screening: Check how often a test agrees with the confirmed diagnosis when diseased and healthy patients are unevenly represented.
- • Spam and content filtering: Summarize a day of email or comment labels before deciding whether the filter needs retraining.
- • Model comparison in class: Give students one metric to rank two classifiers, then show why the ranking can flip once class balance changes.
Accuracy is the most quoted classification metric because it is intuitive: count the hits, divide by the trials. The trouble starts when the hits are easy. A model that labels every incoming message as not-spam can still look superb if 99 percent of your mail really is clean, even though it misses every real threat. That is why this calculator reports sensitivity and specificity next to accuracy rather than leaving you with a percentage that conceals the weak spots.
The companion confusion matrix calculator builds the grid this tool reads, so if you only have raw predictions you can assemble the four cells there first and then paste the totals here.
A confusion matrix calculator builds the full four-cell grid from raw predictions, which is the same input this accuracy tool reads.
How the Accuracy Formula Works
An accuracy calculator adds the two cells that represent correct calls, true positives and true negatives, then divides by the grand total of all four cells. The result is the fraction of predictions that were correct, shown here as a percentage. The same four numbers feed sensitivity and specificity, which split the score by class instead of blending them.
- TP (true positives): Actual positive cases the model predicted as positive.
- TN (true negatives): Actual negative cases the model predicted as negative.
- FP (false positives): Actual negative cases wrongly predicted as positive.
- FN (false negatives): Actual positive cases wrongly predicted as negative.
Sensitivity, sometimes called recall, is TP divided by (TP + FN): it measures how many of the real positives the model actually found. Specificity is TN divided by (TN + FP): how many of the real negatives it correctly left alone. Both sit between 0 and 100 percent. When the two classes are equally sized, accuracy lands near the middle of sensitivity and specificity; when they are not, accuracy can drift far from either.
If you are comparing a measured rate with an expected one, a percent error calculator shows how far two percentages drift, which is a different kind of check from the class-balanced view above.
Balanced dataset
TP = 50, FN = 10, FP = 5, TN = 100. Total = 165.
Accuracy = (50 + 100) / 165 = 150 / 165 = 0.9091, or 90.91 percent.
Accuracy = 90.91 percent.
Sensitivity is 50 / 60 = 83.33 percent and specificity is 100 / 105 = 95.24 percent, so the model is stronger on negatives than positives.
Imbalanced screening
TP = 5, FN = 1, FP = 4, TN = 90. Total = 100.
Accuracy = (5 + 90) / 100 = 95 percent.
Accuracy = 95 percent.
Sensitivity is only 5 / 6 = 83.33 percent, revealing that the 95 percent headline leans on the easy negative cases.
According to Wikipedia: Confusion matrix, accuracy is the proportion of correct predictions computed as (TP + TN) over all four confusion matrix cells
When you compare a predicted rate against an observed one, a percent error calculator shows how far the two percentages drift from each other.
Key Concepts Behind Accuracy
Three ideas keep accuracy honest: what a correct prediction actually means, why one number blends two very different failure modes, and how class balance reshapes the score.
True versus false
A prediction is true when the model's label matches reality, and false when it does not. Accuracy only counts the true rows, so it treats one missed disease exactly like one mislabeled spam.
Sensitivity and specificity
These two metrics split accuracy by class. Sensitivity cares about catching positives; specificity cares about clearing negatives. Reporting both exposes a model that is good at one and poor at the other.
Class balance
When negatives dominate, a model can score high accuracy by almost always guessing negative. Balance decides whether accuracy reflects skill or just the dataset's shape.
Threshold and costs
Moving the decision threshold reshapes the four cells, and the cost of a false negative is often far higher than a false positive, which a single accuracy number cannot communicate.
Thinking in terms of sensitivity prevents the trap of praising a model that quietly ignores the rare but important class. An accuracy calculator that reports sensitivity next to the headline percentage, such as this one, keeps that weakness visible, which is the number clinicians and fraud teams watch most.
Because accuracy hides weak recall, a sensitivity calculator reports the share of real positives the model actually caught.
How to Use This Calculator
Gather the four counts from your classification results, type them in, and read the three metrics that appear beside the totals.
- 1 Collect the four cells: From your confusion matrix, note the true positive, false negative, false positive, and true negative counts.
- 2 Enter the values: Type each count into its field. Non-integer entries are truncated to whole predictions before the math runs.
- 3 Read accuracy, sensitivity, specificity: Accuracy appears first, followed by sensitivity and specificity, with the total prediction count shown for a quick sanity check.
- 4 Compare against balance: If sensitivity and specificity are far apart, the single accuracy figure is hiding an uneven performance across classes.
A quiz grader marks 80 correct answers and 20 wrong ones out of 200 questions, where 30 questions were actually hard. Mapping those to a confusion matrix and entering the counts shows whether the grader's accuracy survives once you weigh the hard subset separately.
After you measure accuracy on a sample, a standard error calculator tells you how much that estimate would wobble across repeated draws.
Benefits of Computing Accuracy This Way
Reporting accuracy beside sensitivity and specificity turns a feel-good percentage into a defensible evaluation.
- • One view, three metrics: You get the headline accuracy and the class-split metrics in the same place, so no single number gets quoted out of context.
- • Fast sanity check: The total prediction count is shown alongside the rates, making it obvious when an input was mistyped or a class was empty.
- • Clear failure mode: Separating sensitivity from specificity tells you whether the model misses positives or mislabels negatives, which points to different fixes.
When you report a missed diagnosis or a rejected good transaction, using an accuracy calculator together with a relative error calculator frames the size of the slip as a share of the relevant class instead of hiding it inside a blended score.
Expressing a missed diagnosis as a fraction of all positives pairs well with a relative error calculator when you report model mistakes.
Factors That Change the Result
Accuracy is sensitive to how the data is shaped, not just to how good the model is, so a few factors decide whether the number means what you think.
Class imbalance
When one class vastly outnumbers the other, accuracy rewards predicting the majority class and can stay high even when the model finds almost no minority cases.
Mislabeled ground truth
Accuracy can only be as trustworthy as the labels it is checked against; noisy labels drag every cell toward the wrong total.
Threshold choice
Moving the decision threshold changes which predictions land in each cell, so the same model can show very different accuracy at 0.5 versus 0.8.
- • Accuracy alone cannot tell you whether errors are false positives or false negatives, which matters when the two mistakes carry different costs.
- • On tiny samples a single misclassified case swings the percentage by several points, so treat the figure as approximate until the sample is large.
An accuracy calculator on its own cannot show whether errors lean toward false positives or false negatives, which is why balanced accuracy only equals ordinary accuracy when the classes are perfectly balanced. Always read sensitivity and specificity before quoting a headline number, especially on medical or fraud data where the rare class is the one that matters.
According to scikit-learn: Model evaluation, balanced accuracy equals ordinary accuracy only when classes are perfectly balanced
A survey-style margin of error calculator frames the band around an estimate, the same caution you need before trusting a single accuracy figure.
Frequently Asked Questions
Q: How do you calculate accuracy from a confusion matrix?
A: Add the true positives and true negatives, then divide by the total of all four cells: true positives, false negatives, false positives, and true negatives. Multiply by 100 to read it as a percentage. This accuracy calculator does that division for you and also returns sensitivity and specificity from the same four counts.
Q: What is the difference between accuracy and precision in classification?
A: Accuracy is the share of all predictions that were correct. Precision is the share of positive predictions that were actually correct, which is true positives divided by true positives plus false positives. A model can have high accuracy yet low precision if it makes many false positive calls.
Q: Why can accuracy be misleading on imbalanced datasets?
A: If one class is far larger, a model that almost always predicts that majority class scores high accuracy while missing most of the minority cases. Sensitivity and specificity expose this by reporting performance separately for each class, which is why this calculator shows them next to accuracy.
Q: Is 95 percent accuracy good for a classifier?
A: It depends on the class balance and the cost of each error. On a balanced dataset 95 percent is strong, but on data where 96 percent of cases are negative, a model that always predicts negative already reaches 96 percent while catching none of the positive cases. Always check sensitivity before judging.
Q: How are sensitivity and specificity related to accuracy?
A: Sensitivity is true positives over all actual positives; specificity is true negatives over all actual negatives. When the two classes are equally sized, accuracy sits near the average of the two. When they are not, accuracy can sit far from either, which is why all three are reported together.
Q: What does an accuracy of 1 mean?
A: An accuracy of 1, or 100 percent, means every prediction matched the true label: zero false positives and zero false negatives. It indicates a perfect split on the data you entered, though it says nothing about how the model would perform on different data.