Skip to content
Calcrivo

Matthews Correlation Coefficient (MCC) Calculator

Calculate the Matthews Correlation Coefficient, a balanced measure of binary classification quality even on imbalanced data.

Inputs

Matthews Correlation Coefficient

0.8262

Numerator

67,800

Denominator

82,059.7343

Step by step

  1. Numerator: (TP × TN) − (FP × FN)

    (80 × 850) − (20 × 10)

    = 67800

  2. Denominator: √[(TP+FP)(TP+FN)(TN+FP)(TN+FN)]

    √[(80+20)(80+10)(850+20)(850+10)]

    = 82059.7343

  3. MCC: numerator / denominator

    67800 ÷ 82059.7343

    = 0.8262

How it works

The Matthews Correlation Coefficient (MCC) is a single-number summary of binary classification quality that uses all four confusion matrix values: MCC = (TP×TN − FP×FN) / √[(TP+FP)(TP+FN)(TN+FP)(TN+FN)]. It ranges from -1 (total disagreement) through 0 (no better than random) to +1 (perfect prediction). Unlike accuracy or F1, MCC accounts for true negatives directly and remains informative even on severely imbalanced datasets, which is why it's often recommended as the preferred single-metric summary for binary classifiers.

Formula

MCC = (TP * TN - FP * FN) / sqrt((TP + FP)(TP + FN)(TN + FP)(TN + FN))

TP
True positives
TN
True negatives
FP
False positives
FN
False negatives

Frequently Asked Questions

Why is MCC considered better than accuracy for imbalanced data?

MCC incorporates all four confusion matrix cells (TP, TN, FP, FN) in a balanced way, so a model that only performs well on the majority class will not score highly, unlike accuracy which can be dominated by the majority class.

What does an MCC of 0 mean?

An MCC of 0 indicates the classifier's predictions are no better than random guessing given the class distribution — it carries no useful correlation between predictions and actual labels.

Can MCC be undefined?

Yes — if the denominator is zero (which happens when the model predicts only one class, or the confusion matrix has an entire row or column of zeros), MCC is undefined; this calculator returns 0 in that case as a safe fallback.

You might also need