F1 Score Calculator

Balancing Two Metrics That Pull in Opposite Directions

Precision and recall usually trade off against each other — tightening a classifier to reduce false positives tends to let more false negatives through, and vice versa. F1 score is the harmonic mean of the two, which penalizes imbalance more heavily than a simple average would, so a classifier can't score well by being excellent at one metric while ignoring the other.

The Formula

F1 = 2 × (Precision × Recall) / (Precision + Recall)

The harmonic mean is used rather than the arithmetic mean specifically because it stays low if either precision or recall is low — a model with 100% precision and 10% recall gets an F1 of about 18%, not 55%.

Where This Matters

  • Imbalanced classification — F1 is a standard metric when the positive class is rare, since accuracy alone can hide poor performance on it.
  • Model comparison — ranking classifiers with a single number when precision and recall move in opposite directions between models.
  • Information retrieval — search and recommendation systems commonly report F1 to balance returning relevant results against missing them.

How Precision/Recall Imbalance Affects F1

F1 score at different precision/recall combinations
PrecisionRecallF1 Score
90%90%90.00%
100%50%66.67%
100%10%18.18%
60%60%60.00%

Computed from F1 = 2 × (Precision × Recall) / (Precision + Recall).

How to Use This Calculator

  1. Choose From Precision & Recall or From Confusion Matrix Counts as the input mode.
  2. For the precision/recall mode, enter Precision (%) and Recall (%) directly.
  3. For the counts mode, enter True Positives, False Positives, and False Negatives.
  4. Select Calculate to get the F1 score.

Related Calculations

See the full breakdown of correct and incorrect predictions with the Confusion Matrix Calculator, or compare classifier ranking ability with the ROC AUC Calculator.