Productive Toolbox

F1 Score Calculator

Calculate the F1 Score from Precision and Recall, or directly from a confusion matrix (TP, FP, FN), with step-by-step breakdown and performance rating. Free and browser-based.

F1 Score Calculator

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

Inputs

Examples:

F1 Score

Enter valid inputs on the left to calculate the F1 score.

Performance Rating Guide

90% – 100%Excellent
75% – 89%Good
60% – 74%Average
Below 60%Needs Improvement

Export & Share

What Is an F1 Score Calculator?

An F1 score calculator is a free browser-based tool that computes the F1 Score — the harmonic mean of Precision and Recall — used to evaluate classification models across machine learning, information retrieval, and AI research. It answers a question neither Precision nor Recall can answer alone: how well does my model balance avoiding false alarms against catching every real positive?

The calculator supports two input modes: enter Precision and Recall directly if you already have them, or enter a confusion matrix of True Positive, False Positive, and False Negative counts and let the tool derive Precision and Recall automatically before combining them into the F1 Score.

This tool is built for machine learning engineers, data scientists, AI researchers, students, teachers, data analysts, Kaggle competitors, software engineers, and researchers. It supports adjustable decimal precision, shareable calculation URLs, and CSV/TXT/JSON export — running entirely in your browser with no signup required.

How the F1 Score Calculator Works

In Confusion Matrix mode, the calculator first derives Precision and Recall from your TP, FP, and FN counts, then combines both into the F1 Score using the harmonic mean formula.

Core Formulas

Precision = TP ÷ (TP + FP)

Recall = TP ÷ (TP + FN)

F1 Score = 2 × (Precision × Recall) ÷ (Precision + Recall)

  • Two Input Modes: Switch instantly between entering Precision and Recall directly, or entering a confusion matrix — the calculator handles the intermediate math for you in the latter case.
  • Harmonic Mean, Not Average: F1 uses the harmonic mean rather than a simple average, which penalizes a large imbalance between Precision and Recall far more heavily — a model that's great at one and terrible at the other still gets a low F1 score.
  • Division-by-Zero Handling: If Precision and Recall are both zero, the calculator returns an F1 score of 0 instead of an undefined result.
  • Performance Rating: The F1 percentage is automatically classified from Needs Improvement to Excellent, giving instant context to the raw number.

How to Use the F1 Score Calculator

Step-by-Step Guide

  1. 1Choose an Input Mode: Select Precision + Recall if you already computed those metrics, or Confusion Matrix if you have raw True Positive, False Positive, and False Negative counts.
  2. 2Enter Your Values: Type Precision and Recall as decimals between 0 and 1, or type your TP, FP, and FN counts — Precision and Recall are derived automatically in Confusion Matrix mode.
  3. 3Adjust Decimal Precision: Choose how many decimal places to display, from 2 to 6, to match the precision your reporting needs.
  4. 4Review the Live Result: The F1 score, its performance rating, and the full calculation breakdown update instantly as you type.
  5. 5Copy, Export, or Share: Copy the full report, download it as CSV, TXT, or JSON, print it, or copy a shareable URL that encodes all your inputs.

Key Features

  • Two calculation modes: Precision + Recall, or Confusion Matrix (TP, FP, FN)
  • Automatic Precision and Recall derivation in Confusion Matrix mode
  • Instant calculation with a 150ms debounce as you type
  • Automatic performance rating from Needs Improvement to Excellent
  • Full formula breakdown with substituted values
  • Adjustable decimal precision from 2 to 6 places
  • Quick example presets for spam filtering, fraud detection, and medical screening
  • Shareable calculation URL using query parameters
  • Export report as CSV, TXT, or JSON, plus a printable layout
  • Calculation history — save and reload up to 20 past results
  • All processing runs locally — no data leaves your browser

Real-World Use Cases

Evaluating a Spam Filter

An engineer tests a spam filter with TP = 90, FP = 10, FN = 15. Precision = 0.90, Recall ≈ 0.8571, and F1 ≈ 0.8780 — rated Good, showing the filter balances catching spam against wrongly flagging real emails.

Comparing Two Models via Precision and Recall

A data scientist has two models: one with Precision = 0.82 and Recall = 0.91 (F1 ≈ 0.8627), another with Precision = 0.95 and Recall = 0.70 (F1 ≈ 0.8058). Despite the second model's higher precision, its lower F1 shows the first is more balanced overall.

Fraud Detection Model at Scale

A fraud team evaluates a large-scale model with TP = 450, FP = 40, FN = 70. The calculator returns Precision ≈ 0.9184, Recall ≈ 0.8654, and F1 ≈ 0.8911 — rated Excellent, confirming the model is production-ready.

Reporting Results in a Kaggle Competition

A competitor derives their leaderboard score by entering their submission's confusion matrix counts, instantly getting the exact F1 score their model achieved without writing evaluation code.

Medical Screening Reliability Check

A healthcare analyst evaluates a diagnostic test with TP = 15, FP = 5, FN = 3, getting Precision = 0.75, Recall ≈ 0.833, and F1 ≈ 0.7895 — informing whether the test's balance of false alarms and missed cases meets clinical standards.

Tuning a Classification Threshold

A machine learning engineer recalculates F1 at several decision thresholds, watching Precision rise and Recall fall as the threshold increases, and picks the threshold that maximizes the F1 score for their deployment.

Tips & Common Mistakes

Pro Tips

  • 💡Use F1 score when Precision and Recall matter roughly equally to you — if one matters much more, consider the Fβ score or optimize for that metric directly instead.
  • 💡Report F1 alongside Precision and Recall individually, not instead of them — F1 hides which of the two is dragging the score down.
  • 💡On imbalanced datasets, F1 is usually a better single-number summary than accuracy, since accuracy can look deceptively high by just predicting the majority class.
  • 💡When comparing models with the confusion matrix mode, keep test set size and class distribution identical between runs so the comparison is fair.
  • 💡Track F1 across training epochs or threshold sweeps to visually spot the point where Precision and Recall are best balanced for your use case.

Common Mistakes to Avoid

  • Don't average Precision and Recall arithmetically instead of using the harmonic mean — a simple average masks large imbalances that F1 is specifically designed to penalize.
  • Don't assume a high F1 score means a good model in every context — F1 ignores True Negatives entirely, so it says nothing about how well the model handles the negative class.
  • Don't compare F1 scores computed on different class distributions or different decision thresholds without noting the difference — F1 shifts as the threshold changes.
  • Don't forget that Precision and Recall inputs in Precision + Recall mode must be between 0 and 1, not 0 and 100 — enter 0.82, not 82.
  • Don't rely on F1 alone for multi-class problems without checking whether you need macro, micro, or weighted averaging — a plain F1 score is defined for binary classification.

F1 Score Performance Rating Table

F1 Score RangeRating
90% – 100%Excellent
75% – 89%Good
60% – 74%Average
Below 60%Needs Improvement

* These ranges are general guidance. Thresholds for what counts as an acceptable F1 score vary by domain and class balance.

Frequently Asked Questions

What is an F1 score calculator?

An F1 score calculator is a free browser-based tool that computes the F1 Score — the harmonic mean of Precision and Recall — from either those two metrics directly or a confusion matrix of True Positive, False Positive, and False Negative counts.

How is the F1 score calculated?

F1 Score = 2 × (Precision × Recall) ÷ (Precision + Recall). If you only have a confusion matrix, first compute Precision = TP ÷ (TP + FP) and Recall = TP ÷ (TP + FN), then combine them with this formula.

What is a good F1 score?

90% and above is generally considered excellent, 75–89% good, 60–74% average, and below 60% needs improvement — though the right threshold depends on your application and how balanced your data is.

What is the difference between F1 score and accuracy?

Accuracy uses all four confusion matrix outcomes and can look misleadingly high on imbalanced datasets by favoring the majority class. F1 score only uses Precision and Recall, making it more informative when correctly identifying the positive class matters most.

How do I calculate F1 score from a confusion matrix?

Switch to Confusion Matrix mode and enter TP, FP, and FN. The calculator derives Precision and Recall automatically, then combines them into the F1 Score — no manual intermediate calculation needed.

Why is F1 the harmonic mean instead of a regular average?

The harmonic mean punishes a large gap between Precision and Recall much more severely than an arithmetic average. A model with Precision = 1.0 and Recall = 0.01 averages to 0.505 arithmetically, but its F1 score is only about 0.0198 — correctly signaling the model is nearly useless.

What happens if Precision and Recall are both zero?

The calculator returns an F1 score of 0 rather than an undefined result, since a model that never correctly predicts a positive case has no useful F1 score to report.

Can I use F1 score for multi-class classification?

This calculator computes the standard binary F1 score. For multi-class problems, F1 is typically calculated per class and then combined using macro, micro, or weighted averaging — use a Confusion Matrix Analyzer for that level of detail.

When should I not rely on F1 score alone?

F1 score assumes Precision and Recall are equally important and ignores True Negatives entirely. If your application cares much more about one error type than the other, or True Negatives matter to your evaluation, consider a weighted Fβ score or a fuller confusion matrix analysis instead.

Is my data private when using this calculator?

Yes. All calculations run entirely in your browser using JavaScript. Your input values are never transmitted to any server, stored in any database, or accessible to anyone other than you.

Who Uses This Calculator?

🤖

Machine Learning Engineers

Evaluate and tune classification models during development and after retraining.

📊

Data Scientists & AI Researchers

Report standardized F1 scores in experiments and published research.

🎓

Students & Teachers

Learn and teach the F1 score formula with instant, transparent calculations.

🏆

Kaggle Competitors

Quickly verify F1-based leaderboard scores from submission confusion matrices.

💻

Software Engineers

Validate classifier output during QA before shipping a model to production.

🔬

Researchers

Compare balanced model performance across experiments and published baselines.