ToolSphere

Confusion Matrix Calculator

Computer science

Compute accuracy, precision, recall, specificity, and F1 score from a 2x2 confusion matrix. Enter TP, FP, FN, and TN counts to evaluate classifier metrics.

Confusion matrix → precision / recall / F1

Enter a binary classifier's confusion matrix counts to compute standard evaluation metrics.

Total samples
100
Accuracy
85.00%
Precision (PPV)
83.33%
Recall (sensitivity/TPR)
90.91%
Specificity (TNR)
77.78%
F1 Score
86.96%

On this browser only

Give feedback

Did this tool help?

Tell us what worked, what didn’t, or what you’d like next.

Opens Google Forms in a new tab with this tool’s name filled in. No sign-in or email required. Feedback is optional.

How to use Confusion Matrix Calculator

  1. 1Enter your classifier's True Positive, False Positive, False Negative, and True Negative counts.
  2. 2Review the computed accuracy, precision, recall, specificity, and F1 score.
  3. 3Copy any individual metric with the inline copy button.

About Confusion Matrix Calculator

Confusion Matrix Calculator

Turns a binary classifier's confusion matrix (True Positive, False Positive, False Negative, and True Negative counts) into the standard evaluation metrics: accuracy, precision (positive predictive value), recall (sensitivity/true positive rate), specificity (true negative rate), and F1 score (the harmonic mean of precision and recall).

These metrics answer different questions about a model's performance, and no single one tells the whole story. Accuracy measures overall correctness but can be misleading on imbalanced data; precision measures how trustworthy positive predictions are; recall measures how many actual positives were caught; F1 balances the latter two into one number.

Typical use cases: evaluating a machine learning classifier during coursework or research, sanity-checking a model's reported metrics by recomputing them from the raw counts, or comparing two models on the same test set.

Enter your four counts and every metric recalculates instantly, with clear labels so you don't have to memorize which formula produces which value.

Guides and tutorials

Frequently asked questions

Why use F1 score instead of accuracy?

Accuracy can be misleading on imbalanced datasets — a classifier that always predicts the majority class can have high accuracy while being useless. F1 balances precision and recall, which is more informative when positive and negative classes aren't equally common.

What does it mean if precision shows 'undefined (÷0)'?

It means the classifier made zero positive predictions (TP + FP = 0), so precision — which divides by that sum — has no defined value for this matrix.

What's the difference between recall and specificity?

Recall measures how many actual positives the classifier correctly caught (TP / (TP+FN)); specificity measures how many actual negatives it correctly caught (TN / (TN+FP)). A model can score high on one and low on the other.

Have a suggestion for Confusion Matrix Calculator?Share your feedback ↗