Classification Accuracy Calculator

Calculate accuracy, precision, recall, specificity, and F1 score from a binary confusion matrix.

Classification metrics
Enter the four confusion-matrix counts to evaluate a binary classifier.

About classification accuracy

Classification accuracy measures the share of all predictions that a model classified correctly. It combines true positives and true negatives, then divides that sum by every observation in the confusion matrix. Accuracy is intuitive, but it should rarely be interpreted alone. When classes are imbalanced, a model can predict the common class almost every time and still report a high accuracy while failing on the cases that matter most. This calculator therefore reports five complementary binary-classification metrics. Precision is the proportion of predicted positives that are genuinely positive, calculated as TP divided by TP plus FP. Recall, also called sensitivity, is the proportion of actual positives found by the model, calculated as TP divided by TP plus FN. Specificity measures how well the model identifies negatives: TN divided by TN plus FP. The F1 score is the harmonic mean of precision and recall, so it rewards models that balance both rather than maximizing one at the expense of the other. Begin by translating your evaluation results into a confusion matrix. A true positive is a positive case correctly predicted positive. A false positive is a negative case incorrectly predicted positive. A true negative is a negative case correctly predicted negative, and a false negative is a positive case missed by the classifier. All four entries must be counts from the same test set and decision threshold. Mixing percentages, training observations, or results from different thresholds makes the metrics invalid. Metric priorities depend on the application. In medical screening, missing a condition may be costly, so recall often receives more attention. In spam filtering or automated enforcement, false accusations may be costly, making precision important. Specificity is useful when correct rejection of negatives matters. Compare metrics across the same dataset, inspect class prevalence, and consider confidence intervals before declaring one model superior. The calculator provides deterministic point estimates for quick analysis, documentation, and threshold comparisons; it does not replace validation on representative data.

Accuracy calculation examples

Confusion matrixKey resultsInterpretation
TP 80, FP 20, TN 90, FN 10Accuracy 85.00%; F1 84.21%Strong, fairly balanced performance
TP 50, FP 0, TN 50, FN 0All metrics 100.00%Perfect classification on this sample
TP 10, FP 5, TN 180, FN 5Accuracy 95.00%; Recall 66.67%High accuracy hides missed positives

How to calculate classification metrics

  1. Count the true positives and false positives in the evaluated predictions.
  2. Count the true negatives and false negatives from the same dataset.
  3. Enter all four non-negative counts in the matching fields.
  4. Select Calculate Metrics and compare accuracy with precision, recall, specificity, and F1 score.

Frequently asked questions

What is a good classification accuracy?

A good accuracy depends on class balance, baseline performance, and the cost of each error. Compare it with a simple baseline and inspect the other metrics before judging the model.

Why can accuracy be misleading?

Accuracy weights every correct prediction equally and can be dominated by a large majority class. A model may have high accuracy while detecting very few minority-class cases.

What is the difference between precision and recall?

Precision asks how many predicted positives were correct. Recall asks how many actual positives the classifier successfully found.

When should I use the F1 score?

Use F1 when both false positives and false negatives matter and you want one balance-oriented measure. It does not account for true negatives, so also review accuracy and specificity.

Can I enter percentages instead of counts?

Use counts whenever possible because all cells must share the same denominator. Proportional values only work if they are consistently scaled and represent the complete confusion matrix.