F1 Score Calculator
The formula, when to use F0.5 or F2 instead, and a worked example.
Free · No sign-up · Runs in your browser
Open the F1 calculator Loads TP 40 · FP 10 · FN 20 · TN 930 Jump to the formulaUnderstanding the F1 Score
What Is the F1 Score?
The harmonic mean of precision and recall. It stays high only when both are high, so one strong number can't hide a weak one.
F1 Score Formula
From precision and recall:
| F1-Score | 2 · Precision · Recall / (Precision + Recall) |
Or straight from the counts (same result):
| F1-Score | 2·TP / (2·TP + FP + FN) |
F-beta: Weighting Precision vs. Recall
F-beta tilts the balance when one error costs more:
- F0.5: favors precision. Use when false positives cost more (fraud flags).
- F1: equal weight.
- F2: favors recall. Use when false negatives cost more (disease screening).
Fβ = (1+β²)·P·R / (β²·P + R). At β=1 it is F1.
Worked Example: A Search Engine's Results
A search returns 50 documents: 40 relevant (TP=40), 10 not (FP=10). It missed 20 relevant ones (FN=20). The 930 it correctly left out (TN=930) don't affect F1.
| Metric | Formula | Calculation | Result |
|---|---|---|---|
| Precision | TP / (TP+FP) | 40 / 50 | 80% |
| Recall | TP / (TP+FN) | 40 / 60 | 66.67% |
| F1-Score | 2·P·R / (P+R) | 2(.80)(.6667) / (.80+.6667) | 72.73% |
| F0.5 | (1+.25)PR / (.25P+R) | weights precision higher | 76.92% |
| F2 | (1+4)PR / (4P+R) | weights recall higher | 68.97% |
Same results, three scores. Pick the one that matches your costlier error. Try your own counts or see all 22 formulas.
Frequently Asked Questions
What is a good F1 score?
No fixed cutoff. On balanced data, 0.8+ is strong and 0.9+ excellent. A better test is comparing F1 against a baseline model on your own data.
How is F1 score different from accuracy?
Accuracy counts true negatives; F1 ignores them. On imbalanced data a model can score high accuracy by predicting the majority class while its F1 stays low.
What is F2 score and how is it different from F1?
F2 is F-beta with β=2: recall counts twice as much as precision. Use it when missing a positive costs more than a false alarm. F0.5 does the reverse.
Can the F1 score be negative or above 1?
No. Precision and recall are both between 0 and 1, so F1 is too. 1 means both are perfect; 0 means at least one is zero.
How do I calculate F1 score from a confusion matrix instead of from precision and recall?
F1 = 2·TP / (2·TP + FP + FN). Same result as 2·P·R / (P + R), without computing precision and recall first. New to the counts? See TP, TN, FP, FN.