Skip to content
FiftyCalc Free calculators for all 50 states

Matthews Correlation Coefficient Calculator

Test cases replayed : 3 of 3 match · Methodology · No outside source listed

Enter the four counts of a binary confusion matrix to get the Matthews correlation coefficient, a balanced score from −1 to +1.

Result

Sample figures

Matthews correlation coefficient (MCC)—

Normalized MCC, (MCC + 1) ÷ 2 —

  • Accuracy—
  • F1 score—

Estimate for planning only, not tax, legal, financial or medical advice. This calculator uses the method explained on this page.

Matthews Correlation Coefficient Calculator

True positives (TP): enter 0 or more. Prefilled example: 90.

False positives (FP): enter 0 or more. Prefilled example: 10.

False negatives (FN): enter 0 or more. Prefilled example: 15.

True negatives (TN): enter 0 or more. Prefilled example: 885.

How to use this calculator

Fill in the fields in this order; each step takes you to its field.

  1. True positives (TP): enter 0 or more.
  2. False positives (FP): enter 0 or more.
  3. False negatives (FN): enter 0 or more.
  4. True negatives (TN): enter 0 or more.
  5. Read the result: Matthews correlation coefficient (MCC); the panel also shows Normalized MCC, (MCC + 1) ÷ 2, Accuracy and F1 score.

How this calculator works

MCC = (TP × TN − FP × FN) ÷ √((TP + FP)(TP + FN)(TN + FP)(TN + FN)) (Matthews, Biochimica et Biophysica Acta, 1975). It equals the phi coefficient of the 2 × 2 table.

+1 is a perfect prediction, 0 is no better than chance, −1 is total disagreement. Unlike accuracy, MCC stays low when a model only does well on the larger class. If a row or column of the table is empty the formula is undefined and the result shows a dash.

The formula

  1. Mcc=tp×tn−fp×fn(tp+fp)×(tp+fn)×(tn+fp)×(tn+fn)
Symbols used in the formula
SymbolMeaning
tpTrue positives (TP)
fpFalse positives (FP)
fnFalse negatives (FN)
tnTrue negatives (TN)
MccMatthews correlation coefficient (MCC)

Worked example

True positives (TP)90
False positives (FP)10
False negatives (FN)15
True negatives (TN)885
Normalized MCC, (MCC + 1) ÷ 20.9322
Accuracy97.5%
F1 score0.878
  1. Mcc=90×885−10×15(90+10)×(90+15)×(885+10)×(885+15)=0.86445

Matthews correlation coefficient (MCC) 0.8644

Each step uses the unrounded value of the step before it; figures on this page are rounded for display.

Frequently asked questions

Why use MCC instead of accuracy?

On imbalanced data a model that always predicts the majority class can score high accuracy while learning nothing; its MCC is 0 or undefined.

What is the MCC for TP = 90, FP = 10, FN = 15, TN = 885?

(90 × 885 − 10 × 15) ÷ √(100 × 105 × 895 × 900) ≈ 0.8644, while accuracy is 97.5%.

Questions answered

Related calculators