Data Science & ML
Basic

Classification Accuracy

Fraction of predictions that are correct.

Formula

Accuracy=TP+TNTP+TN+FP+FNAccuracy = \frac{TP + TN}{TP + TN + FP + FN}

Live Calculator

Members

Variables

TPTrue positives
TNTrue negatives
FPFalse positives
FNFalse negatives

Example

(90+5)/(100) = 0.95 = 95% accuracy

How it works

Classification accuracy measures how often a classifier is right overall. It adds the cases it got correct: true positives and true negatives, then divides by all predictions made, so the result is the share of predictions that matched the true labels. This works because every prediction falls into exactly one of four categories: correct positive, correct negative, false positive, or false negative.

When to use it

Use accuracy when you want a quick summary of overall performance for a classification model, especially when the classes are fairly balanced. It is common in tasks like spam detection, disease screening, image labeling, and any binary or multiclass prediction problem where you care about the fraction correct.

Worked example, step by step

Suppose a model makes 200 predictions. TP = 72, TN = 108, FP = 12, FN = 8 Accuracy = (TP + TN) / (TP + TN + FP + FN) Accuracy = (72 + 108) / (72 + 108 + 12 + 8) Accuracy = 180 / 200 Accuracy = 0.90 Accuracy = 90%

Common mistakes to avoid

  • Using accuracy alone even when one class is very rare, which can hide poor performance on the minority class
  • Swapping false positives and false negatives when counting the confusion matrix
  • Forgetting that the denominator is the total number of predictions, not just the correct ones

Did You Know?

Accuracy is misleading on imbalanced datasets.

Share this formula

Reviewed & maintained by the FormulaWon editorial teamLast reviewed September 2026