Math · Machine learning · F1 and F-beta
F1 score calculator.
Get the F1 score, or any F-beta such as F2 or F0.5, from true positives, false positives and false negatives. True negatives are not needed.
With TP = 30, FP = 20 and FN = 10, precision is 60%, recall 75% and F1 is 0.6667. Weighting recall twice as heavily (F2) gives 0.7143.
Inputs
Your result
Fill the form and press Calculate.
The formulas
F1 is the harmonic mean of precision and recall. In counts, scikit-learn writes it as F1 = 2TP / (2TP + FP + FN), which equals 2PR / (P + R). The general F-beta score is Fβ = (1 + β2) · precision · recall / (β2 · precision + recall), or equivalently (1 + β2)TP / ((1 + β2)TP + FP + β2FN). scikit-learn uses the count form to avoid dividing by zero when precision and recall are both zero. True negatives do not appear anywhere in F1.
Worked example
TP 30, FP 20, FN 10. Precision = 30/50 = 60%, recall = 30/40 = 75%. F1 = 60 / (60 + 20 + 10) = 0.6667. F2 = 5 × 30 / (5 × 30 + 20 + 4 × 10) = 150/210 = 0.7143; it is higher than F1 here because recall (75%) is above precision (60%). F0.5 = 1.25 × 30 / (1.25 × 30 + 20 + 0.25 × 10) = 0.6250.
Picking beta
Choose β above 1 when missing a positive costs more than a false alarm, and below 1 when the reverse holds. F1 treats them equally. Because F1 ignores true negatives, it can hide poor performance on the negative class; Chicco and Jurman show cases where MCC separates models that F1 cannot. When TP, FP and FN are all zero the score is undefined (scikit-learn returns 0.0 by default and warns); this page shows "undefined".
Sources, opened 15 October 2026: scikit-learn f1_score; scikit-learn User Guide, Metrics and scoring; Chicco D, Jurman G (2020), The advantages of the Matthews correlation coefficient (MCC) over F1 score and accuracy in binary classification evaluation, BMC Genomics 21:6.
Frequently asked questions
How do you calculate the F1 score?
F1 = 2 × precision × recall / (precision + recall), or 2TP / (2TP + FP + FN). With TP 30, FP 20, FN 10 it is 60 / 90 = 0.6667.
What is a good F1 score?
There is no universal threshold. It depends on class balance, the cost of each error and the baseline for your problem. Compare against a simple baseline on the same data rather than a fixed number.
What is the difference between F1 and F2?
F1 weights precision and recall equally. F2 (beta = 2) counts recall four times as heavily in its weighting, so it rewards finding positives over avoiding false alarms.
Why does F1 not use true negatives?
It is built only from precision and recall, and neither involves TN. That is useful when negatives are abundant and uninteresting, but it can hide errors on the negative class.
Is F1 the same as accuracy?
No. Accuracy counts all correct predictions including true negatives. F1 counts only the positive class performance.
Learning and planning aid
Results are computed in your browser from the numbers you enter and the formulas described above. Check them against your own evaluation code before relying on them in a paper or a production decision.