Confusion Matrix Analyzer
Analyze classification model performance from confusion matrix values. Calculate precision, recall, F1 score, MCC, accuracy, specificity, and more.
About this calculator
This calculator turns four raw counts — True Positives, False Positives, True Negatives, and False Negatives — into the standard classification metrics. Precision is tp / (tp + fp) and Recall is tp / (tp + fn) (lines 11-12), and neither formula ever references True Negatives, so True Negatives has zero effect on both. Since F1 Score is built purely from Precision and Recall (2·P·R / (P+R), line 13), it inherits that same blind spot and never responds to True Negatives either — a fact that surprises people expecting F1 to summarize "all four" quadrants of the matrix the way Accuracy does. Specificity, on the other hand, is tn / (tn + fp) (line 14) and is correspondingly blind to True Positives and False Negatives.
Accuracy is the only headline metric here that uses all four counts at once ((tp + tn) / total, line 10). The Matthews Correlation Coefficient (line 19-23) is the one metric designed specifically to stay informative even when the two classes are wildly imbalanced, since it multiplies all four cells together in its numerator rather than only ever looking at two or three of them. This calculator does not report confidence intervals or statistical significance for any metric — with small counts, a plausible sampling difference of just a few cases can shift Precision, Recall, or F1 by several points, and this page has no way to distinguish that noise from a genuine change in model performance.
Inputs
Results
Accuracy
0.9
Precision
0.83
Recall (Sensitivity)
0.91
F1 Score
0.87
How to Use This Calculator
- Enter the true positive, false positive, true negative, and false negative counts from your model.
- Review accuracy, precision, recall (sensitivity), and F1-score.
- Check specificity and Matthews Correlation Coefficient for balanced evaluation.
- Identify whether false positives or false negatives are more costly for your use case.
- Adjust the classification threshold to trade off precision vs. recall based on business requirements.
How the result changes with False Positives (FP)
| False Positives (FP) | Accuracy | Precision | Recall (Sensitivity) |
|---|---|---|---|
| 5 | 0.93 | 0.91 | 0.91 |
| 7.5 | 0.91 | 0.87 | 0.91 |
| 15 | 0.87 | 0.77 | 0.91 |
| 25 | 0.81 | 0.67 | 0.91 |
What each input means
- True Positives (TP)
- Correctly predicted positive cases — the model said positive and it was positive.
- False Positives (FP)
- Incorrectly predicted positive cases — the model said positive but it was negative (Type I error).
- True Negatives (TN)
- Correctly predicted negative cases — the model said negative and it was negative.
- False Negatives (FN)
- Incorrectly predicted negative cases — the model said negative but it was positive (Type II error).
How this is calculated
Worked example, using the default values
- Identify Input Parameters4 parametersTrue Positives (TP) = 50, False Positives (FP) = 10, True Negatives (TN) = 80, False Negatives (FN) = 5 = 4 input(s) provided
- Calculate AccuracyAccuracy0.8966 = 0.8966
- Calculate PrecisionPrecision0.8333 = 0.8333
- Calculate RecallRecall0.9091 = 0.9091
- Calculate Matthews Correlation Coeff.Matthews Correlation Coeff.0.7862 = 0.7862
- Calculate SpecificitySpecificity0.8889 = 0.8889
Engine last updated . Checked against 1 independently-derived test — how we verify calculators. Built by Paul Gunder, a software engineer, not a licensed financial, medical, or legal professional.
Frequently Asked Questions
Does the number of True Negatives affect the Precision or Recall shown?
No. Precision is tp / (tp + fp) and Recall is tp / (tp + fn) (lines 11-12) — neither formula includes True Negatives at all, so raising or lowering True Negatives leaves both figures completely unchanged, even though it does move Accuracy and Specificity.
Why doesn't F1 Score respond to True Negatives if it's supposed to be an overall metric?
F1 Score is the harmonic mean of Precision and Recall alone (2·P·R / (P+R), line 13), and since neither of those two inputs uses True Negatives, F1 inherits that same blind spot. It summarizes how well positives are found and confirmed, not overall correctness — that's what Accuracy and Balanced Accuracy are for.
Which metrics ignore True Positives and False Negatives entirely?
Specificity (tn / (tn + fp), line 14) and False Positive Rate (1 − specificity, line 15) both depend only on True Negatives and False Positives. They measure how well the model avoids false alarms on the negative class, independent of how it performs on positives at all.
What makes the Matthews Correlation Coefficient different from the other metrics here?
MCC's numerator is tp·tn − fp·fn (line 19) — the only formula on this page that multiplies all four counts together at once, rather than using only two or three of them. That's why it's commonly recommended over Accuracy or F1 when the positive and negative classes are very unevenly sized.
Related Calculators
The questions that sit next to this one — chosen by subject, including calculators filed under a different category.
Feature Scaling Calculator
Scale raw feature values using min-max normalization, z-score standardization, robust scaling, and max-abs normalization for machine learning preprocessing.
Data ScienceA/B Test Calculator
Determine statistical significance of A/B test results. Calculate z-score, p-value, conversion lift, and whether your variant beats the control at your chosen confidence level.
Machine Learning & AIModel Performance Calculator
Complete ML model evaluation. Classification metrics, regression analysis, cross-validation, ROC/AUC curves, and model comparison.
Machine Learning & AIModel Performance Metrics Calculator
Calculate accuracy, precision, recall, F1 score, MCC, AUC, and other classification performance metrics.
StatisticsROC Curve Calculator
Calculate sensitivity, specificity, PPV, NPV, accuracy, F1 score, and approximate AUC from a confusion matrix (TP, FP, TN, FN).
More in Math & Statistics.