Matthews Correlation Coefficient (MCC) Calculator

Calculate MCC from confusion matrix with full metrics: accuracy, F1, precision, recall, specificity, Cohen's kappa, informedness, markedness, and visual confusion matrix.

Matthews Correlation Coefficient (MCC) Calculator

MCC
0.750939
Strong positive — excellent classifier
Accuracy
87.50%
175 correct of 200
F1 Score
0.8718
Harmonic mean of precision & recall
Cohen\'s Kappa
0.7500
Agreement beyond chance
Precision (PPV)
89.47%
Of predicted Positive: 89.5% correct
Recall (Sensitivity)
85.00%
Of actual Positive: 85.0% found
Specificity (TNR)
90.00%
Of actual Negative: 90.0% identified
Balanced Accuracy
87.50%
Average of recall and specificity
MCC = (TP×TN − FP×FN) / √((TP+FP)(TP+FN)(TN+FP)(TN+FN))
= (85×9010×15) / √((85+10)(85+15)(90+10)(90+15))
= 7,500 / 9,987.49 = 0.750939

Confusion Matrix

Pred. PositivePred. NegativeTotal
Actual PositiveTP = 85FN = 15100
Actual NegativeFP = 10TN = 90100
Total95105200

All Classification Metrics

MetricValueFormulaRange
MCC0.7509(TP·TN−FP·FN)/√(…)[−1, +1]
Accuracy0.8750(TP+TN)/N[0, 1]
Balanced Accuracy0.8750(TPR+TNR)/2[0, 1]
Precision (PPV)0.8947TP/(TP+FP)[0, 1]
Recall (TPR)0.8500TP/(TP+FN)[0, 1]
Specificity (TNR)0.9000TN/(TN+FP)[0, 1]
F1 Score0.87182·P·R/(P+R)[0, 1]
NPV0.8571TN/(TN+FN)[0, 1]
FPR0.1000FP/(FP+TN)[0, 1]
FNR0.1500FN/(TP+FN)[0, 1]
Cohen\'s Kappa0.7500(Acc−Pₑ)/(1−Pₑ)[−1, +1]
Informedness0.7500TPR+TNR−1[−1, +1]
Markedness0.7519PPV+NPV−1[−1, +1]
Prevalence0.5000(TP+FN)/N[0, 1]

MCC Interpretation

MCC RangeInterpretationUse case
+0.7 to +1.0Strong agreementProduction-ready classifier
+0.4 to +0.7ModerateUseful with domain context
+0.1 to +0.4WeakBetter than random, needs improvement
−0.1 to +0.1NoneNo better than random guessing
−1.0 to −0.1InverseClassifier is systematically wrong — flip predictions
Planning notes, formulas, and examples

About the Matthews Correlation Coefficient (MCC) Calculator

The Matthews Correlation Coefficient (MCC) is a balanced way to score binary classifiers, especially when the classes are imbalanced and accuracy alone can be misleading.

This calculator takes a confusion matrix and reports MCC alongside the other metrics people commonly compare against it: accuracy, balanced accuracy, precision, recall, specificity, F1, Cohen's kappa, and related rates. That makes it easier to see why two models with similar accuracy can still have very different practical quality.

MCC ranges from −1 to +1, where +1 is perfect agreement, 0 is no useful discrimination, and −1 means the predictions are effectively inverted.

When This Page Helps

MCC is useful because it stays informative when the class balance is skewed and when a model can game accuracy by overpredicting the majority class. Comparing it directly against accuracy, F1, and balanced accuracy helps show whether the classifier is genuinely useful or only superficially impressive.

How to Use the Inputs

  1. Enter TP (true positives), FP (false positives), FN (false negatives), and TN (true negatives).
  2. Or select a preset scenario to explore different classifier behaviors.
  3. Review the MCC value and its interpretation.
  4. Check the visual confusion matrix to verify your inputs.
  5. Compare MCC with accuracy, F1, and balanced accuracy.
  6. Examine the complete metrics table for a 360° view of classifier performance.
  7. Use the MCC interpretation guide to assess production-readiness.
Formula used
MCC = (TP·TN − FP·FN) / √((TP+FP)(TP+FN)(TN+FP)(TN+FN)). Range: [−1, +1]. MCC = 0 = random. MCC = +1 = perfect.

Example Calculation

Result: MCC = 0.7528, Accuracy = 87.5%, F1 = 0.8718, Precision = 89.47%, Recall = 85.0%

MCC of 0.75 indicates strong agreement between predictions and reality. Despite 12.5% error rate, the classifier correctly handles both positives and negatives, with slightly better specificity than sensitivity.

Tips & Best Practices

  • Try "All Positive Pred" preset — accuracy looks reasonable but MCC reveals zero discrimination.
  • Compare MCC with F1: they agree for balanced classes but diverge for imbalanced ones.
  • MCC = √(Informedness × Markedness) gives a geometric interpretation.
  • If MCC is negative, literally flipping all predictions improves the classifier.
  • For medical screening (high FN cost), focus on recall alongside MCC.
  • Use the "Imbalanced (95-5)" preset to understand why accuracy alone fails.

MCC vs. Accuracy: The Imbalanced Data Problem

Consider a disease affecting 1% of patients. A classifier that always predicts "healthy" achieves 99% accuracy — impressive-looking but useless. Its MCC is exactly 0, correctly indicating no discriminative ability. This example explains why MCC has become the recommended primary metric in machine learning competitions and medical AI.

Mathematical Properties of MCC

MCC is the Pearson correlation between actual and predicted binary labels (encoded 0/1). This means all properties of Pearson correlation apply: MCC = +1 implies perfect prediction, −1 implies perfect inverse prediction, and 0 implies independence. The formula (TP·TN − FP·FN)/√((TP+FP)(TP+FN)(TN+FP)(TN+FN)) is equivalent to Pearson r on binary variables.

When Other Metrics Complement MCC

MCC gives one number but hides the precision-recall tradeoff. If FP and FN have very different costs — false positive in cancer screening vs. false negative — you need precision and recall separately. ROC-AUC shows performance across all thresholds. Use MCC as the primary evaluation metric, then drill into precision, recall, and domain-specific costs for deployment decisions.

Sources & Methodology

Last updated:

Frequently Asked Questions

  • If 95% of samples are negative, predicting "always negative" gives 95% accuracy but MCC = 0 (no useful discrimination). MCC requires good performance on both classes, making it impossible to game with trivial strategies.