What Is F1 Score?
The F1 score combines precision and recall in a single number: F1 = 2 × precision × recall ÷ (precision + recall). Because it uses the harmonic mean, it is pulled down sharply when either precision or recall is low, so a model cannot score well by doing well on only one of them.
The calculator also shows F-beta scores, where beta above 1 weights recall more and beta below 1 weights precision more, and compares the harmonic mean with the arithmetic and geometric means of precision and recall. F1 ignores true negatives, which matters when they are a large share of the data.
Below you will find the formulas, a variables table, a worked example and answers to common questions such as F1 versus accuracy.
How to Use the F1 Score Calculator
- Choose counts or precision/recall as the input.
- Enter your values; the calculator derives the missing metrics.
- Choose a beta if recall or precision matters more than the other.
- Compare F1 with the arithmetic mean in the results: a large gap means one of the two is weak.
F1 Score Formula
F1 score
F-beta score
F1 Score Variables Explained
| Symbol | Meaning | Notes |
|---|---|---|
| P | Precision | TP ÷ (TP + FP) |
| R | Recall | TP ÷ (TP + FN) |
| F1 | Harmonic mean of P and R | 2PR ÷ (P + R) |
| β | Weight of recall relative to precision | β = 1 gives F1 |
F1 Score Worked Example
Using the example values (press “Load example” above to try them):
- Precision = TP ÷ (TP + FP) = 60 ÷ 75 = 0.8; recall = TP ÷ (TP + FN) = 60 ÷ 85 = 0.705882.
- F1 = 2PR ÷ (P + R) = 2 × 0.8 × 0.70588 ÷ (0.8 + 0.70588) = 0.75.
- F-beta = (1 + β²)PR ÷ (β²P + R) = 0.75.
Result: F1 score = 0.75; F-beta (β = 1) = 0.75.
Why the harmonic mean?
With the arithmetic mean, precision 1.0 and recall 0.0 would average to 0.5, which looks respectable for a model that finds nothing useful. The harmonic mean punishes that imbalance: the same pair gives an F1 of 0. A model must keep both numbers reasonably high to get a high F1.
| Precision | Recall | Arithmetic mean | F1 |
|---|---|---|---|
| 0.90 | 0.90 | 0.90 | 0.90 |
| 0.90 | 0.50 | 0.70 | 0.64 |
| 0.99 | 0.10 | 0.545 | 0.18 |
| 1.00 | 0.00 | 0.50 | 0.00 |
F-beta: tuning the balance
Choose β by how much more you value recall than precision. F2 treats recall as twice as important and suits screening or fraud detection, where missing a case is costly. F0.5 favours precision and suits situations where false alarms are expensive, such as automated enforcement.
| Score | β | Emphasis |
|---|---|---|
| F0.5 | 0.5 | Precision |
| F1 | 1 | Balanced |
| F2 | 2 | Recall |
Limits of F1
- It ignores true negatives, so it says nothing about how well the negative class is handled.
- It depends on which class you call positive; swapping classes changes the score.
- For multi-class problems you must choose how to average: macro (each class equal), micro (pooled counts) or weighted (by class size).
- MCC or balanced accuracy use all four cells and can be a better single metric.
Where F1 Score Is Used
Evaluating classifiers
Summarising precision and recall in one score.
Imbalanced classes
Scoring a model when accuracy would be misleading.
Choosing a trade-off
Using F2 when missed positives cost more, or F0.5 when false alarms do.
Reporting model results
Giving F1 alongside precision and recall.
Common F1 Score Mistakes to Avoid
- Specify which class is positive when reporting F1.
- In multi-class reports state the averaging method.
- Use F-beta if the costs of the two error types are not equal.
- Check precision and recall individually, not only their combination.
F1 Score Terms and Definitions
- Harmonic mean
- The reciprocal of the average of reciprocals; pulled towards the smaller value.
- Macro-average
- Average of per-class scores, treating classes equally.
F1 Score FAQs
What is the F1 score?
The harmonic mean of precision and recall, a single score from 0 to 1 that is high only when both are high.
How do you calculate F1 from TP, FP and FN?
F1 = 2TP ÷ (2TP + FP + FN).
Is a higher F1 score always better?
Yes, higher is better, but a good value depends on the problem. Compare against a baseline and against the costs of each error type.
What is a good F1 score?
It depends on the task. Above 0.9 is excellent in many settings, 0.7 to 0.9 is good, and anything below 0.5 usually needs improvement, but compare with a baseline model.
What is the difference between F1 and accuracy?
Accuracy counts all correct predictions, including true negatives. F1 looks only at the positive class, which makes it far more informative for rare events.
What is macro vs micro F1?
Macro F1 averages the F1 of each class equally. Micro F1 pools all TP, FP and FN first, so large classes dominate.