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
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.
This browser did not allow copying. The sentence is in the box below, already selected: copy it with your keyboard or the menu.
How to use this calculator
Fill in the fields in this order; each step takes you to its field.
- True positives (TP): enter 0 or more.
- False positives (FP): enter 0 or more.
- False negatives (FN): enter 0 or more.
- True negatives (TN): enter 0 or more.
- 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
| Symbol | Meaning |
|---|---|
| True positives (TP) | |
| False positives (FP) | |
| False negatives (FN) | |
| True negatives (TN) | |
| Matthews 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) ÷ 2 | 0.9322 |
|---|---|
| Accuracy | 97.5% |
| F1 score | 0.878 |
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%.