F1 Score

F1 Score Calculator

Calculate your F1 score instantly using precision and recall or confusion matrix values. A simple tool for machine learning, classification, and model evaluation.

Please enter a valid non-negative integer.
Please enter a valid non-negative integer.
Please enter a valid non-negative integer.
Please enter a valid non-negative integer.
Please enter a valid number between 0 and 100.
Please enter a valid number between 0 and 100.
0.00%
F1 Score
Decimal F1 Score
0.0000
Precision
0.00%
Recall
0.00%

What Is F1 Score?

The F1 score is a crucial evaluation metric in machine learning classification that combines both precision and recall into a single harmonic mean. It is particularly useful when you need to balance these two metrics, especially in scenarios involving imbalanced datasets where a high accuracy might be misleading.

F1 Score Formula

The F1 score can be calculated using either the base metrics (Precision and Recall) or directly from the confusion matrix values.

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

Using Confusion Matrix values (True Positive, False Positive, False Negative):

F1 = 2TP / (2TP + FP + FN)

How to Calculate F1 Score

  1. Input your TP, FP, and FN values, or switch to the Precision & Recall mode.
  2. The calculator automatically derives precision and recall if the confusion matrix mode is used.
  3. It then computes the harmonic mean of precision and recall.
  4. The final F1 score is displayed in both decimal and percentage formats.

Interpreting F1 Score

A higher F1 score indicates a stronger combination of precision and recall on your evaluation data. The score ranges from 0 to 1 (or 0% to 100%), where 1 represents perfect precision and recall. However, what constitutes a "good" F1 score heavily depends on the specific context of your problem, the baseline performance, and the cost of false positives versus false negatives in your domain.

Example Calculation

Let's take a scenario where TP = 45, FP = 10, and FN = 5.

F1 = 2 × 45 / (2 × 45 + 10 + 5)
F1 = 90 / (90 + 10 + 5)
F1 = 90 / 105
F1 ≈ 0.8571 = 85.71%

F1 Score vs Precision vs Recall

Metric Formula Objective
Precision TP / (TP + FP) Measures quality. Out of all positive predictions, how many were actually positive?
Recall TP / (TP + FN) Measures quantity. Out of all actual positives, how many were found?
F1 Score Harmonic Mean Strikes a balance between Precision and Recall.

Frequently Asked Questions

1. What is an F1 Score Calculator?
An F1 Score Calculator is an online tool designed for data scientists and machine learning engineers to quickly compute the F1 evaluation metric based on confusion matrix parameters or existing precision and recall values.
2. How do you calculate F1 score?
You calculate the F1 score by taking the harmonic mean of precision and recall. The mathematical formula is 2 * (Precision * Recall) / (Precision + Recall).
3. Can I calculate F1 score using precision and recall?
Yes, our calculator includes a dedicated mode specifically for inputting precision and recall percentages directly to find the resulting F1 score.
4. What are TP, FP, FN, and TN?
These are elements of a confusion matrix. TP (True Positive): correct positive prediction. FP (False Positive): incorrect positive prediction. FN (False Negative): incorrect negative prediction. TN (True Negative): correct negative prediction.
5. What is a good F1 score?
There is no universal threshold. A "good" score depends entirely on your specific dataset, problem domain, and whether your model needs to prioritize minimizing false positives or false negatives.
6. What happens when precision and recall are both zero?
If both precision and recall are zero, the denominator of the F1 formula becomes zero. Mathematically undefined, it is operationally treated as an F1 score of 0% in this calculator.
7. Is F1 score useful for imbalanced datasets?
Yes, the F1 score is highly recommended for imbalanced datasets because it does not rely on True Negatives (which can overwhelm the metric in imbalanced data), unlike standard accuracy.
8. What is the difference between accuracy and F1 score?
Accuracy evaluates all correct predictions (both positive and negative) over total predictions. F1 score ignores true negatives and focuses purely on the balance between true positives, false positives, and false negatives. One is not always better than the other; the right choice depends on your evaluation goals.
View Related F1 Score Calculator Tags ▼
F1 Score Calculator F1 Score Calculator Online Online F1 Score Calculator F1 Score Calculation Calculate F1 Score F1 Score Formula F1 Score from Precision and Recall Precision Recall F1 Calculator F1 Metric Calculator F-Measure Calculator F Measure Score Calculator Machine Learning F1 Score Classification Metrics Calculator Binary Classification F1 Score Model Evaluation Calculator Precision Calculator Recall Calculator Harmonic Mean Calculator F1 Score Formula Calculator Confusion Matrix Calculator True Positive Calculator False Positive Calculator False Negative Calculator TP FP FN Calculator F1 Score from Confusion Matrix F1 Score Percentage F1 Score Decimal F1 Score Online Tool AI Model Performance Calculator Data Science Calculator Machine Learning Metrics Classification Performance Metrics F1 Score Explained How to Calculate F1 Score F1 Score Example Precision and Recall Formula F1 Evaluation Metric Precision Recall Balance F1 Score for Imbalanced Data Binary Classifier Metrics Supervised Learning Metrics ML Evaluation Tools True Positive False Positive False Negative F1 Score Output Calculator Model Accuracy and F1 Score F1 Score for Classification Compare Precision and Recall F1 Score Statistics F1 Score Learning Tool Free F1 Score Calculator
Success