Confusion Matrix Calculator – Accuracy, F1, MCC

Confusion Matrix Calculator

Enter true positives, false positives, false negatives, and true negatives to calculate accuracy, precision, recall, specificity, F1 score, MCC, and classification error patterns from one 2x2 matrix.

🎯Confusion Matrix Presets

📝Classification Inputs

Sets the wording used in the interpretation notes.

Name the target class, disease, defect, alert, or event.

Name the non-target class or normal condition.

Predicted positive and actually positive.

Predicted positive but actually negative.

Predicted negative but actually positive.

Predicted negative and actually negative.

Controls percentages and decimal metrics.

Accuracy 0% (TP + TN) / total
Precision 0% TP / (TP + FP)
Recall 0% TP / (TP + FN)
F1 Score 0% 2PR / (P + R)

🧮Metric Summary Grid

-Specificity
-MCC
-False Positive Rate
-False Negative Rate
-Prevalence
-Total Cases

📋Current Confusion Matrix

📐Metric Formula Table

🔎Preset Comparison Table

PresetTPFPFNTNBest metric to watch
Rare fraud alerts1453105599490Precision and MCC reveal false-alert load.
Spam filter batch842061088020090F1 balances blocked spam and missed spam.
Cancer screening audit92458855Recall matters when misses carry high risk.
Vision defect line318132429508Specificity controls rework volume.
Churn risk model6207803403260Precision tells how focused the outreach list is.
Search relevance classifier22103902904110Accuracy and F1 both stay useful.
Loan default monitor4309201708480MCC resists the class imbalance.
Wildlife camera detector7601802403820Recall and false negatives guide tuning.
Emergency triage model1461604690Recall dominates for rule-out safety.
Quality retest gate6480161840Low prevalence makes PPV sensitive to FP.

Interpretation Bands

MetricLower rangeMiddle rangeHigher rangeWhat it controlsCaution
AccuracyBelow 70%70% to 90%90%+Overall correct shareCan look high with rare positives.
PrecisionBelow 50%50% to 80%80%+Quality of positive predictionsIgnores false negatives.
RecallBelow 50%50% to 80%80%+Capture of actual positivesIgnores false alarms.
SpecificityBelow 70%70% to 95%95%+Clearance of actual negativesDoes not show missed positives.
F1 scoreBelow 50%50% to 80%80%+Precision-recall balanceDoes not use true negatives.
MCCBelow 0.200.20 to 0.600.60+All four matrix cellsUndefined when a marginal is zero.

💡Confusion Matrix Tips

Check class balance: Accuracy can be impressive when the negative class dominates, even if the model misses too many positives. Compare accuracy with recall, precision, and MCC before deciding that a classifier is production-ready.
Choose by error cost: If false negatives are expensive, tune for recall and inspect FN counts. If false positives create costly reviews, watch precision and specificity. F1 is useful when both positive-side errors matter.

This calculator uses the standard binary-classification formulas from the four raw cells TP, FP, FN, and TN. Validate threshold choice, sample design, and labeling quality before using the metrics for operational decisions.

Is this a fraud? Will I get cancer from this tumor? Is this email spam? It sounds like a simple yes/no question, but the answer never come so easily.

Maybe we’ll run a prediction model to determine whether a transaction is fraudulent. Or maybe a diagnostic test will indicate that there’s something amiss. Or perhaps our spam filter flags a phishing link. At first glance, it appear that we’ve got the problem solved.

Why Accuracy Is Not Enough

But there is a dirty little secret in data science: the right prediction isn’t worth anything unless we understand how much it costs to be wrong. So instead of simply looking at headline accuracy score, we look deeper into confusion matrix. And that’s where the calculator above comes in, converting raw numbers into easy-to-understand performance metrics. But knowing what they mean doesn’t come from plugging them in; you have to know what they represent.

This brings us back to our 2×2 table of true positives/false positives/false negatives/true negatives. This is the basic table that everything else is built on. It’s what your classifier does, four cells, each with its own story to tell.

Your hits are the true positives. And your quiet moments, when it got it right and didn’t bother, are the true negatives.

Then there are the errors. Your false positives are the alarms that proved to be nothing, wasting resources and time. And your false negatives are the silent failures, the threats or diseases that slipped through the net.

That’s the central tension in every binary classification problem: You can’t eliminate both errors at once, unless you also improve the signal underneath. So you must decide how much of either one you can live with less then the other.

People make this mistake: they consider overall accuracy and assume that they’re fine. Then they realize their model never works. A model that just returns ‘healthy’ all the time will be 99.9% accurate. Sounds great! But what if you’re screening for a rare disease with one-in-a-thousand rate? This model won’t find any patient. Accuracy is seductive because it’s simple to grasp, but it can be blind to class imbalance.

Also, precision and recall matter. Precision protects you from false alarms: how many of your positive predictions were actualy correct? Recall protects you from misses: how many of the actual positives did you manage to catch? You can think about this tension as trade-offs.

The calculator reminds you of them and even gives you an overall score that balances those competing needs, which is the F1 score (also known as the harmonic mean of recall and precision). That means you have to admit that raising your score on one will tend to lower it on another. For example, if you make your positive prediction threshold more lenient, you will increase your recall… You’ll catch more true positives; but you’ll also pick up more false positives, lowering your precision.

The F1 score penalizes dramatic differences between the two, so you get a single number that captures how well model does at both. That’s a nice summary, though it has one major blind spot: it doesn’t consider true negatives at all, which can be a big problem in certain contexts.

The Matthews Correlation Coefficient (MCC) is where it’s at. Unlike the F1 score, the MCC considers all four cells in your confusion matrix. It’s a solid metric. Even if your data is highly imbalanced, it will give you a high score as long as you’re doing well on both classes. In other words, it’s robust and only gives you a high score when you’ve gotten good results across both classes. If it predicts perfectly, you’ll get a score of 1; if it predicts randomly, you’ll get a 0; if it completely disagrees with what you want, then -1. Basically, MCC is mathematically stricter and tends to be more honest about how well you’re performing compared to accuracy or F1. See here for a clear reference table that explains how each metric reacts to various kinds of errors.

The cost of an error matters in real-world decisions. You can’t miss a case of cancer; tune for high recall (with higher false positives to get tested). You don’t want to miss a legitimate invoice from your supplier; tune for high precision (accepting some spam instead). You need to specify that cost… There’s no single best score here, just the correct one given your own risk tolerance. That’s what this tool helps you quantify.

In the end, that’s what a confusion matrix does: reflect your model’s bias back at you. It tells you who (or what) will pay the price for its mistakes. If you’re screening out patients, fighting spam, or detecting fraud, whatever it is… Then you need to make sure your metrics line up with your values.

Catching the right things doesn’t matter much unless they’re the ones you care about most. What should you catch? What can you miss? That’s on you. The math just makes it clear.

Confusion Matrix Calculator – Accuracy, F1, MCC