Confusion Matrix Calculator

This calculator turns the four raw counts behind any binary classification model - true positives, false positives, false negatives and true negatives - into every standard performance metric analysts and machine learning practitioners rely on. You enter TP, FP, FN and TN from your model's test results (or use the worked defaults of 50, 10, 5 and 35), and the tool builds a live matrix visualisation showing predicted versus actual outcomes alongside the total observations, predicted positives and negatives, and actual positives and negatives. From those counts it instantly returns accuracy, precision, recall (sensitivity), specificity, F1 score and the Matthews correlation coefficient (MCC), plus a fuller breakdown covering false positive rate, false negative rate and negative predictive value. A plain-language verdict summarises what the numbers mean and flags whether performance is strong, moderate or weak based on the MCC. Use it to check a model quickly during development, to compare two classifiers on the same test set, or to understand which trade-off - precision against recall - matters most for your problem. Because accuracy alone can be misleading on imbalanced datasets, pay close attention to the F1 score and MCC alongside it, since both weigh false positives and false negatives more evenly. The calculator applies standard formulas for two-class problems only; multi-class classification needs an extended confusion matrix with macro or micro-averaged metrics instead.

Calculate.co.nz is proud to be partnered with Health Based Building, a leader in sustainable and health-conscious building innovation. With over a century of experience, they develop high-performance systems like Foreverbreathe Specification, Magnum Board, and Foreverbreathe Paints to support energy-efficient, non-toxic living environments. Their commitment to healthier homes aligns with our belief that informed choices lead to better outcomes for Kiwi households.
Calculate.co.nz partner: Health Based Building
Standard formulas  Based on standard binary classification evaluation metrics used in statistics and machine learning.

1. Enter Confusion Matrix Values

Please enter valid non-negative numbers (total must be greater than zero).

2. Matrix Visualisation

Predicted → / Actual ↓

Predicted Positive
Predicted Negative
Actual Positive
TP
50
FN
5
Actual Negative
FP
10
TN
35
Total observations: 100

Classification Performance Metrics

Accuracy
-
(TP + TN) / Total
Precision
-
TP / (TP + FP)
Recall (Sensitivity)
-
TP / (TP + FN)
Specificity
-
TN / (TN + FP)
F1 Score
-
Harmonic mean of P & R
MCC
-
Matthews Correlation Coeff.

Full Metric Breakdown

True Positives (TP)50
False Positives (FP)10
False Negatives (FN)5
True Negatives (TN)35
Total observations100
Predicted positives60
Predicted negatives40
Actual positives55
Actual negatives45

Derived Metrics

Accuracy85.00%
Precision (PPV)83.33%
Recall / Sensitivity (TPR)90.91%
Specificity (TNR)77.78%
F1 Score86.96%
MCC0.698
False Positive Rate (FPR)22.22%
False Negative Rate (FNR)9.09%
Negative Predictive Value (NPV)87.50%
Summary: Enter your values above to see a performance summary.

Understanding Confusion Matrix Metrics

A confusion matrix is the starting point for evaluating any binary classification model. It records four counts that describe how well a model separates the positive class from the negative class, and from those four numbers every standard classification metric can be derived.

The Four Core Counts

TermSymbolMeaning
True PositivesTPThe model predicted positive and the actual label is positive. Correct positive predictions.
False PositivesFPThe model predicted positive but the actual label is negative. Also called Type I errors or false alarms.
False NegativesFNThe model predicted negative but the actual label is positive. Also called Type II errors or misses.
True NegativesTNThe model predicted negative and the actual label is negative. Correct negative predictions.

Formulas Used in This Calculator

MetricFormulaInterpretation
Accuracy(TP + TN) / (TP + FP + FN + TN)Proportion of all predictions that are correct.
Precision (PPV)TP / (TP + FP)Of all predicted positives, what fraction are actually positive.
Recall / Sensitivity (TPR)TP / (TP + FN)Of all actual positives, what fraction did the model detect.
Specificity (TNR)TN / (TN + FP)Of all actual negatives, what fraction did the model correctly reject.
F1 Score2 * (Precision * Recall) / (Precision + Recall)Harmonic mean of precision and recall. Balances both metrics into one.
MCC(TP*TN - FP*FN) / sqrt((TP+FP)(TP+FN)(TN+FP)(TN+FN))A balanced measure even for imbalanced classes. Ranges from -1 to +1.
False Positive Rate (FPR)FP / (FP + TN)Proportion of actual negatives that are incorrectly classified as positive.
False Negative Rate (FNR)FN / (FN + TP)Proportion of actual positives that are incorrectly classified as negative.
Negative Predictive Value (NPV)TN / (TN + FN)Of all predicted negatives, what fraction are actually negative.

Worked Example

Using the calculator defaults: TP = 50, FP = 10, FN = 5, TN = 35 (total = 100 observations).

Choosing the Right Metric

Accuracy is intuitive but misleading when classes are imbalanced. For example, if 95% of samples are negative, a model that always predicts negative achieves 95% accuracy while being entirely useless for detecting positives.

Precision is critical when false positives are costly (for example, a spam filter that mistakenly blocks legitimate emails). Recall matters more when false negatives are costly (for example, a cancer screening test that misses actual cases). The F1 score balances the two. The MCC is widely considered the most reliable single-value summary for binary classification because it takes all four quadrants of the confusion matrix into account symmetrically.

Related Calculators

Sources and method: Formulas sourced from Fawcett T. (2006), "An introduction to ROC analysis", Pattern Recognition Letters 27(8):861-874; Powers D.M.W. (2011), "Evaluation: From Precision, Recall and F-Measure to ROC, Informedness, Markedness and Correlation", Journal of Machine Learning Technologies 2(1):37-63. MCC formula as defined by Matthews B.W. (1975), Biochimica et Biophysica Acta 405(2):442-451.

This calculator applies standard binary classification evaluation formulas to the values you enter. Results are valid for two-class (binary) problems only. For multi-class classification, an extended confusion matrix and macro/micro-averaged metrics are required.

If you've found a bug, or would like to contact us, or learn more about James Graham and Calculate.co.nz.

Calculate.co.nz is partnered with Interest.co.nz for New Zealand's highest quality calculators and financial analysis.

Calculate.co.nz is the sister site of CalculatorHub.com, the world's largest calculator website by tool count.

All calculators and tools are provided for educational and indicative purposes only and do not constitute financial advice.

Calculate.co.nz is proudly part of the Realtor.co.nz group, New Zealand's leading property transaction literacy platform, helping Kiwis understand the home buying and selling process from start to finish. Whether you're a first home buyer navigating your first property purchase, an investor evaluating your next acquisition, or a homeowner planning to sell, Realtor.co.nz provides clear, independent, and trustworthy guidance on every step of the New Zealand property transaction journey.

Calculate.co.nz is also partnered with Health Based Building and Premium Homes to promote informed choices that lead to better long-term outcomes for Kiwi households.

Calculate.co.nz is hosted in Auckland via SiteHost new Zealand.

All content on this website, including calculators, tools, source code, and design, is protected under the Copyright Act 1994 (New Zealand). No part of this site may be reproduced, copied, distributed, stored, or used in any form without prior written permission from the owner.

About & trust: Why Calculate is NZ's most comprehensive · By the Numbers · How we compare · Editorial standards · How we keep data current · NZ finance glossary · Research & data · Financial literacy NZ · About · Privacy policy · Terms of use

Reviewed and maintained. Last reviewed 2026-07-19 and checked on a twice-monthly cycle against IRD, RBNZ and Stats NZ. How we keep data current.

© 2026 Calculate.co.nz. All rights reserved. Building free NZ calculators since 2011.