# F1 Score

> The F1 score is one number from 0 to 1 that combines precision and recall, and it stays low unless both of them are reasonably high.

Page: https://formulabro.yunusemrevurgun.com/ai-ml/f1-score/  
Category: AI & Machine Learning  
Published: 2026-10-22  
Updated: 2026-10-22

## Formula

$$
F_1 = \frac{2 \cdot P \cdot R}{P + R}
$$

Read it out loud: "F sub 1 equals 2 times P times R, divided by P plus R. F sub 1 is the F one score. P is precision, a number from 0 to 1, and R is recall, also a number from 0 to 1. The 2 on top makes the score exactly 1 when both precision and recall are perfect."

## Before you start

- **Average, plain and harmonic**: An **average** adds numbers and divides by how many there are. The **harmonic mean** of two numbers $a$ and $b$ is a different average, written $\frac{2ab}{a + b}$. It is built for rates and ratios, and it is always pulled toward the smaller of the two numbers. For example, the harmonic mean of 1 and 0.01 is about 0.02, not about 0.5, so one tiny input drags the result down.
- **Precision and recall**: **Precision** is the share of flagged items that were right, and **recall** is the share of the real positive items that were found. Both are fractions between 0 and 1, and they are described on the precision and recall page. The F1 score is built from these two numbers, so it can only be as good as they are.
- **Fractions between 0 and 1, and percent**: A number between 0 and 1 is a fraction of a whole. 0.8 is the same as 80%, 0.5 is 50%, and 1 is 100%. Scores such as F1 are usually given this way, so 0.727 means about 73% on the score's scale. A score of 1 is perfect and 0 is the worst possible value.
- **The Greek letter beta, $\beta$, and the F-beta score**: The Greek letter $\beta$ (beta) is a weight that changes how much recall counts compared with precision. Its name is said BAY-tuh. The F-beta score uses $\beta$ in its formula. When $\beta = 1$ the two numbers count equally, and that case is the F1 score.

More notation help: https://formulabro.yunusemrevurgun.com/math-basics/

## What each symbol means

- $F_1$: The F1 score: one number from 0 to 1 that combines precision and recall into a single score. It has no unit. A value of 1 means perfect precision and recall, and a value of 0 means that one of the two is zero.
- $P$: Precision: the share of flagged items that are correct. It is a number from 0 to 1 with no unit. A precision of 0.80 means 80% of the flagged items were right, which is a common value in spam filter examples.
- $R$: Recall: the share of real positive items that were found. It is a number from 0 to 1 with no unit. A recall of 0.6667 means about two thirds of the real cases were caught, and the rest were missed.
- $\cdot$: The multiplication dot. $2 \cdot P \cdot R$ means $2 \times P \times R$, which is 2 times precision times recall. The dot is the usual sign for multiplying, and it has no unit.

## The formula piece by piece

- $P \cdot R$: Start by multiplying the two scores. If either one is small, the product is small. For example, 0.8 times 0.6667 is about 0.533, and 1 times 0.1 is only 0.1, so multiplying already makes a weak score stand out.
- $P + R$: Add the two scores. This sum is the bottom of the fraction, and dividing by it turns the product into a balanced average, so that the result stays between 0 and 1 and reflects both scores.
- $\frac{P \cdot R}{P + R}$: The product divided by the sum is the harmonic mean of precision and recall, the balanced average that the F1 score uses. Multiplying by 2 on top makes the score exactly 1 when both precision and recall are 1.
- $F_1 = \frac{2 \cdot P \cdot R}{P + R}$: **The F1 score is two times precision times recall, divided by precision plus recall, which gives one balanced score between 0 and 1 that drops if either precision or recall is low.**
- $F_1 = \frac{2TP}{2TP + FP + FN}$: The same score written with counts instead of fractions. $TP$ is the number of true positives, $FP$ the false positives and $FN$ the false negatives. The two forms always give the same number, because precision and recall are both built from these counts.

## What the formula is doing, and why

Precision and recall often pull in opposite directions, so it helps to have one number that reflects both. The F1 score is that number. It is the **harmonic mean** of precision $P$ and recall $R$, a kind of average that suits rates and ratios like these. To read the formula, double the product of the two scores, then divide by their sum. The result is one score between 0 and 1.

**Why not a plain average?** A plain average, $(P + R) / 2$, lets a high value hide a low one. A precision of 1.0 with a recall of 0.1 averages to 0.55, which looks respectable. The harmonic mean is pulled toward the smaller value, so the F1 score for the same pair is about 0.18. If either precision or recall is near zero, the F1 score is near zero too.

**The count form.** The same score can be found straight from the counts: $F_1 = \frac{2TP}{2TP + FP + FN}$, where $TP$, $FP$ and $FN$ are the true positives, false positives and false negatives from the precision and recall page. This is a true equality, not an approximation. Use whichever form matches the numbers you have, because both give the same result.

**When F1 is the right tool.** The plain F1 score treats precision and recall as equally important. When one of them matters more, the F-beta score weights recall more or less, using the number $\beta$. F1 is the case $\beta = 1$. Use F1 when a false alarm and a miss cost about the same. Otherwise, report precision and recall separately so that nobody has to guess what the single number hides.

## An everyday picture

Imagine a job that needs two skills, and you are graded on both. Suppose one skill scores 100 out of 100 and the other only 10 out of 100. A plain average gives 55, which looks fine. The harmonic style of average used by F1 gives about 18, which shows the weak skill straight away. The F1 score grades precision and recall this way, so a weak spot cannot hide behind a strong one. These scores are illustrative, not measured.

## Worked example: Combining the spam filter's precision and recall

From the precision and recall example, the filter has $P = 0.80$ and $R = 40 / 60 \approx 0.6667$. Its counts are $TP = 40$, $FP = 10$ and $FN = 20$ emails. The score has no unit, and all the numbers are invented for this example.

1. **Write down the two inputs.** F1 needs precision and recall, which we already worked out: precision is 0.80 and recall is about 0.6667. Both are between 0 and 1, so the score will be too. We put them into the formula with a 2 on top: $F_1 = \frac{2 \times 0.80 \times 0.6667}{0.80 + 0.6667}$.
2. **Multiply on the top.** The top is 2 times precision times recall: $2 \times 0.80 \times 0.6667 = 1.0667$. Multiplying the two scores first means that a small score in either one pulls the top down sharply, which is the purpose of this formula.
3. **Add on the bottom.** The bottom is the sum of precision and recall: $0.80 + 0.6667 = 1.4667$. Dividing the product by this sum is what turns the product into a balanced average, so the result stays between 0 and 1 and sits close to the lower of the two scores.
4. **Divide.** $\frac{1.0667}{1.4667} \approx 0.7273$, so $F_1 \approx 0.727$. Now check with the count form: $\frac{2 \times 40}{2 \times 40 + 10 + 20} = \frac{80}{110} \approx 0.7273$. It is the same answer, as it must be, because both forms come from the same counts.
5. **Compare with the plain average.** The plain average of 0.80 and 0.6667 is $(0.80 + 0.6667) / 2 \approx 0.7333$. The F1 score is a little lower, because it is pulled toward the smaller value, which is recall. The gap is small here because the two scores are close together.
6. **Try a lopsided case.** Suppose precision were 1.0 and recall only 0.1. The plain average would be 0.55, but the F1 score is $\frac{2 \times 1.0 \times 0.1}{1.0 + 0.1} \approx 0.182$. The low recall drags the F1 score down hard, which is exactly the behavior we want from a balanced score.

**Answer:** The F1 score is about 0.727. It sits between the precision of 0.80 and the recall of 0.667, and it leans toward the lower of the two. A score of 0.73 on its own does not show which of the two numbers is weaker, so report precision and recall together with the F1 score.

## Common mistakes

- Averaging precision and recall with a plain mean. A high precision can hide a near-zero recall, and the plain mean stays high while the F1 score drops sharply.
- Mixing inputs between the two forms. The precision and recall form needs $P$ and $R$, and the count form needs $TP$, $FP$ and $FN$. Use one set of counts for both, so the two forms agree.
- Treating F1 as the answer to every question. It weights precision and recall equally, which may not match what each mistake costs in your problem.
- Reporting F1 alone. Two models can have the same F1 score and very different precision and recall, so report both when the difference matters.

## Where you will meet it

- Text classifiers and named entity recognition, where F1 is a standard benchmark score for how well the model finds and labels words.
- Information retrieval and search evaluation, where it balances how precise the results are and how complete the set of results is.
- Medical and fraud detection models, where both false alarms and missed cases matter.
- Comparing models in machine learning papers and public leaderboards, where a single number makes the comparison easy to read.

## Questions people ask

### Is F1 the same as accuracy?

No. Accuracy counts every correct answer, including true negatives. F1 ignores true negatives and focuses on the positive class, which is the class you are looking for.

### What is the F-beta score?

A weighted version: $F_\beta = \frac{(1 + \beta^2) P R}{\beta^2 P + R}$. A $\beta$ above 1 gives recall more weight, and a $\beta$ below 1 gives precision more weight. F1 is the case $\beta = 1$, where the formula becomes the one on this page.

### Can F1 be zero?

Yes. If either precision or recall is 0, the top of the fraction is 0, so the F1 score is 0.

## Related formulas

- [Precision and Recall](https://formulabro.yunusemrevurgun.com/ai-ml/precision-and-recall/)
- [Cross-Entropy Loss](https://formulabro.yunusemrevurgun.com/ai-ml/cross-entropy-loss/)
- [Bayes' Theorem](https://formulabro.yunusemrevurgun.com/ai-ml/bayes-theorem/)

## Sources

- [F-score, Wikipedia](https://en.wikipedia.org/wiki/F-score)
- [Precision and recall, Wikipedia](https://en.wikipedia.org/wiki/Precision_and_recall)

From Formula Bro (https://formulabro.yunusemrevurgun.com/), a side project developed by yunusemrevurgun.com.
