Confusion Matrix Calculator (Precision, Recall, F1)
Calculate accuracy, precision, recall, specificity, F1 and MCC from a confusion matrix.
Runs in your browser. Your files never leave your device. See how to check
…
How to do it
- 1Step 1: Open Confusion Matrix Calculator (Precision, Recall, F1) and add your input
Type your numbers or text, add your file, or pick the options you need. Nothing is uploaded: everything stays in your browser.
- 2Step 2: What Confusion Matrix Calculator (Precision, Recall, F1) does
Calculate accuracy, precision, recall, specificity, F1 and MCC from a confusion matrix.
- 3Step 3: Read the result and compare
The result appears at once. Change one value to see how the answer moves, then keep the figure that fits your case.
- 4Step 4: Copy or save it
Copy the result or download it. For an important decision, confirm it with the official source or an adviser.
About this tool
Enter the counts of true positives, false positives, false negatives and true negatives. The calculator gives accuracy, precision, recall (sensitivity), specificity, balanced accuracy, the F1 score and the Matthews correlation coefficient.
Definitions
Accuracy = (TP + TN) ÷ all. Precision = TP ÷ (TP + FP). Recall = TP ÷ (TP + FN). Specificity = TN ÷ (TN + FP). F1 = 2 × precision × recall ÷ (precision + recall). Balanced accuracy = (recall + specificity) ÷ 2.
Matthews correlation coefficient
MCC = (TP × TN − FP × FN) ÷ √((TP+FP)(TP+FN)(TN+FP)(TN+FN)). It ranges from −1 to 1 and stays informative when the classes are very unbalanced.
Use
Accuracy can be misleading when one class dominates. Use precision and recall for the class you care about, and the F1 score as a single balance of the two.
Worked example
85 true positives, 10 false positives, 15 false negatives and 90 true negatives give an accuracy of 87.5%, precision of 89.47%, recall of 85%, specificity of 90%, an F1 score of 0.8718 and an MCC of 0.751.
Tips for best results
Check every box before you rely on a result, because one wrong digit changes the whole answer. Use the exact figures from your payslip, bill, certificate or contract, and keep a note of the date you calculated. Rates, thresholds and rules change from time to time, so for tax, fees and legal matters treat the output as an estimate and confirm with the official source named on this page. You can run as many scenarios as you like; nothing is saved or sent, and refreshing the page clears the boxes.
Quick facts
- Category: Math & Science
- Works in your browser, no sign-up, no upload.
- Your input stays on your device.
- Available in many languages.
- Content last reviewed:
Frequently asked questions
When is accuracy misleading?
When one class is rare.
What is F1?
The harmonic mean of precision and recall.
Precision or recall?
Precision if false alarms are costly, recall if misses are costly.
What is a good MCC?
Above 0.5 is decent; 1 is perfect.
