Confusion Matrix Calculator — MCC, Kappa & All Metrics
Enter the four cells of a binary classifier's confusion matrix — True Positives, True Negatives, False Positives and False Negatives — to compute MCC, Cohen's Kappa, accuracy, precision, recall, F1 and likelihood ratios in one place.
MCC = 1 perfect | 0 random | −1 inverse; robust on imbalanced data
85
TP15
FN10
FP90
TN0.751
MCCTrue Positives (TP)
42.5%
True Negatives (TN)
45%
False Positives (FP)
5%
False Negatives (FN)
7.5%
- 1
Numerator
TP × TN − FP × FN = 85 × 90 − 10 × 15 = 7,500 - 2
Denominator factors
(85+10) × (85+15) × (90+10) × (90+15) = 99,750,000 - 3
Denominator √(factors)
√99,750,000 = 9,987.4922 - 4
MCC
7,500 ÷ 9,987.4922 = 0.7509Ranges from −1 (worst) to +1 (perfect); 0 is no better than chance.
How does this calculator work?
Enter TP, TN, FP, FN from a binary classifier. MCC = (TP·TN − FP·FN) / √((TP+FP)(TP+FN)(TN+FP)(TN+FN)) ranges from −1 to +1 and is the most reliable single metric on imbalanced data. Cohen's Kappa corrects accuracy for chance agreement. Both are superior to raw accuracy when classes are unequal.
Formula
How this is calculated
A confusion matrix is the foundational summary of a binary classifier's performance. Its four cells — True Positives (TP), True Negatives (TN), False Positives (FP), False Negatives (FN) — record every possible combination of predicted and actual class. From these four counts every standard classification metric can be derived.
The Matthews Correlation Coefficient (MCC) is widely considered the single most informative metric for binary classification, especially on imbalanced datasets. Unlike accuracy (misleading when classes are skewed) or F1 (ignores TN), MCC takes all four cells into account and produces a value between −1 (completely wrong) and +1 (perfect), with 0 meaning no better than chance. Cohen's Kappa κ similarly corrects for chance agreement: it subtracts the expected accuracy pe (what accuracy a random classifier would achieve given the marginal totals) from the observed accuracy po, normalised by (1 − pe).
Likelihood ratios further quantify clinical or real-world diagnostic utility: LR+ = Sensitivity / (1 − Specificity) measures how much a positive test result increases the odds of the condition; LR− = (1 − Sensitivity) / Specificity measures how much a negative result decreases those odds. Values of LR+ > 10 or LR− < 0.1 are generally considered diagnostically strong.
Frequently asked questions
Accuracy counts all correct predictions equally: (TP + TN) / total. When one class dominates — say 95% negative — a classifier that always predicts "negative" achieves 95% accuracy while identifying zero positives. MCC incorporates all four matrix cells and gives a balanced measure even when class sizes differ greatly. A perfect all-negative predictor would score MCC = 0 (random), not MCC = 0.95.
Kappa (κ) measures the agreement between the classifier and the ground truth, corrected for the agreement expected by chance alone. κ = 1 is perfect agreement, κ = 0 means the classifier performs no better than random chance given the marginal class frequencies, and κ < 0 means it performs worse than chance. Kappa above 0.80 is generally considered excellent; 0.60–0.80 is substantial.
LR+ (Sensitivity / (1 − Specificity)) tells you how much a positive test result multiplies the pre-test odds of the condition. LR− ((1 − Sensitivity) / Specificity) tells you the factor by which a negative result reduces those odds. Rules of thumb: LR+ > 10 or LR− < 0.1 provide strong diagnostic evidence; LR+ 2–5 or LR− 0.2–0.5 provide moderate evidence.
TG we-Calculate Editorial Team. (2026). Confusion Matrix Calculator — MCC, Kappa & All Metrics [Online calculator]. TG we-Calculate. https://we-calculate.com/calculator/confusion-matrix-calculator
TG we-Calculate Editorial Team. "Confusion Matrix Calculator — MCC, Kappa & All Metrics." TG we-Calculate. 2026. https://we-calculate.com/calculator/confusion-matrix-calculator.
TG we-Calculate Editorial Team, "Confusion Matrix Calculator — MCC, Kappa & All Metrics," TG we-Calculate, 2026. [Online]. Available: https://we-calculate.com/calculator/confusion-matrix-calculator
@misc{wecalculate_confusion_matrix_calculator, title = {Confusion Matrix Calculator — MCC, Kappa & All Metrics}, author = {{TG we-Calculate Editorial Team}}, howpublished = {\url{https://we-calculate.com/calculator/confusion-matrix-calculator}}, year = {2026}, note = {TG we-Calculate} }
Did this calculator help you?
