F1 Score Calculator
F1 score, precision, recall, F-beta, accuracy and MCC from a confusion matrix.
F1 = 2 × precision × recall ÷ (precision + recall) = 2TP ÷ (2TP + FP + FN). With TP = 80, FP = 20 and FN = 40, precision = 0.80, recall = 0.667 and F1 = 0.727.
Free, runs in your browser. Nothing you enter is uploaded.
How to use it
- Enter TP, FP and FN from your confusion matrix (TN is optional).
- Set beta if recall or precision matters more.
- Read precision, recall, F1, F-beta, accuracy and MCC.
What you enter
- TP, FP, FN (TN optional), or precision and recall
What you get
- Precision
- Recall
- F1 and F-beta
- Accuracy
- MCC
Formula
Precision = TP/(TP+FP) | Recall = TP/(TP+FN) | F1 = 2PR/(P+R) | Fβ = (1+β²)PR/(β²P+R)
Worked example
Input: TP 80, FP 20, FN 40
Result: Precision 0.800, recall 0.667, F1 0.727
The model misses a third of real positives; recall is the weak side.
Questions
How do you calculate the F1 score?
F1 is the harmonic mean of precision and recall: 2PR ÷ (P + R). From counts, F1 = 2TP ÷ (2TP + FP + FN).
What is a good F1 score?
It depends on the task and the class balance. Compare against a baseline model; an F1 of 0.7 can be strong for a rare-event problem and weak for an easy one.
Why use F1 instead of accuracy?
With imbalanced classes, a model that always predicts the majority class can score high accuracy but has an F1 of 0 for the minority class.
What does beta do in the F-beta score?
Beta above 1 weights recall more (F2 for screening, where missing cases is costly); beta below 1 weights precision more.
Limitations
- F1 ignores true negatives; use MCC when both classes matter.
References
Related reading
- F1 Score: Definition, Formula and When to Use It
- Accuracy, Precision and Recall: Differences and When to Use Each
More Statistics
- Standard Deviation Calculator
- Mean, Median & Mode Calculator
- Variance Calculator
- Z-Score Calculator
- P-Value Calculator
- Confidence Interval Calculator
- T-Test Calculator
- Chi-Square Test Calculator
- Correlation Coefficient Calculator
- Linear Regression Calculator
- Normal Distribution Calculator
- Probability Calculator
All free tools · By Dr. Zubair Khalid, DVM, MS, PhD.