Matthews Correlation Coefficient Calculator

Evaluate balanced classification performance, compare models, optimize probability thresholds, inspect confusion matrices, and export transparent MCC results with detailed supporting metrics instantly for analysis.

Calculation result

Enter data and calculate to view MCC results.

Ready

Supporting metrics

MetricValueMeaning

Interpretation

Formula and steps


          

Confusion matrix

Threshold analysis

ThresholdMCCAccuracyF1

Model ranking

Choose calculation mode

Use commas, spaces, tabs, semicolons, or new lines.
Labels may be numbers or text class names.
Expected columns: actual,predicted. A header row is optional.
Expected columns: actual,probability. A header row is optional.
Use a numeric square matrix. Optional first row and column may contain class names.

Enter each model’s binary confusion-matrix counts. Models are ranked by MCC.

Formula used

Binary MCC
MCC = (TP × TN − FP × FN) ÷ √[(TP + FP)(TP + FN)(TN + FP)(TN + FN)]
Multiclass MCC
MCC = (c × s − Σ pₖtₖ) ÷ √[(s² − Σpₖ²)(s² − Σtₖ²)]

Here, c is the confusion-matrix trace. The value s is the total sample count. Values pₖ and tₖ are predicted and actual class totals.

How to use this calculator

  1. Select the input mode matching your available data.
  2. Enter counts, labels, probabilities, or a multiclass matrix.
  3. Choose precision and threshold settings when applicable.
  4. Calculate and inspect MCC, supporting metrics, and warnings.
  5. Copy, print, or export the completed results.

Example data

ScenarioTPTNFPFNExpected pattern
Perfect prediction10010000MCC equals +1
Strong balanced model90881210High positive MCC
Imbalanced model409005060MCC reveals minority-class weakness
Near-random model50505050MCC near zero
Reversed prediction00100100MCC equals −1

Understanding Matthews correlation coefficient

MCC measures agreement between observed and predicted classes. It uses every confusion-matrix cell. This makes it valuable for imbalanced classification tasks.

MCC ranges from negative one to positive one. Positive one indicates perfect prediction. Zero indicates performance similar to random assignment.

Negative values indicate systematic disagreement between predictions and labels. A reversed classifier can approach negative one. Context should guide every practical interpretation decision.

Frequently asked questions

1. Why use MCC instead of accuracy?

Accuracy can look strong when one class dominates. MCC includes all confusion-matrix outcomes. It therefore exposes many misleading imbalanced results.

2. What does MCC equal to zero mean?

It usually indicates little linear association between predictions and labels. Performance may resemble random assignment. Dataset structure still matters during interpretation.

3. Can MCC be negative?

Yes. Negative MCC indicates inverse agreement. Strongly reversed predictions can approach negative one.

4. Is MCC useful for multiclass problems?

Yes. The generalized formula supports multiclass confusion matrices. Per-class one-versus-rest values provide additional detail.

5. When is MCC undefined?

MCC is undefined when its denominator becomes zero. This often occurs with absent classes. The calculator reports that condition clearly.

6. How does MCC differ from F1 score?

F1 emphasizes precision and recall for a chosen positive class. MCC also uses true negatives. This provides a more balanced summary.

7. Can probabilities be used directly?

Probabilities must first become class predictions using a threshold. This calculator evaluates selected and optimized thresholds. It also displays threshold performance tables.

8. Which threshold should I choose?

The highest MCC threshold is one useful choice. Business costs may require another threshold. Review precision, recall, and error consequences.

9. Is a high MCC always sufficient?

No single metric captures every deployment concern. Check calibration, subgroup performance, and operational costs. Validate results on unseen representative data.

Related Calculators

Confusion Matrix CalculatorClassification Accuracy CalculatorRecall CalculatorSpecificity CalculatorSensitivity CalculatorFalse Positive Rate CalculatorFalse Negative Rate CalculatorBalanced Accuracy CalculatorLog Loss CalculatorBinary Cross-Entropy Calculator

Important Note: All the Calculators listed in this site are for educational purpose only and we do not guarentee the accuracy of results. Please do consult with other sources as well.