#1 India's Top IT Training Institute

×

About Uncodemy

Know more about who we are and what we stand for.

About Us

About Us

Discover our mission to equip individuals with essential IT skills and industry expertise.

Read More →
UnCodeMy Gallery

UnCodeMy Gallery

Explore highlights from our IT training sessions and success stories.

Read More →
×

Free Resources

Learn, practice and plan your career — bilkul free.

Tutorials

Tutorials

Step-by-step written tutorials to learn any technology at your own pace.

Read More →
Free Counselling

Free Counselling

Book a free video counselling session and pick the right course for you.

Read More →
Online Compiler

Online Compiler

Write, run and test your code online — no setup required.

Read More →
🎯 FREE · BINARY + MULTI-CLASS

F1 Score Calculator: Precision and Recall in One Number

Enter your counts or a full confusion matrix and get every classification metric with the working shown.

  • ⚖️ Precision vs recall
  • 📊 Macro and weighted F1
  • 🧮 F-beta

How to use the F1 Score Calculator

  1. 1. Choose your dataTwo classes with TP, FP, FN and TN, or a confusion matrix with any number of classes.
  2. 2. Enter the numbersType the counts, or paste the matrix with actual classes as rows and predicted as columns.
  3. 3. Read the metricsGet F1, precision, recall and more, with per-class results for matrices.

The formulas

Precision is the share of predicted positives that are right: TP ÷ (TP + FP). Recall is the share of actual positives you found: TP ÷ (TP + FN). F1 is their harmonic mean, 2 × P × R ÷ (P + R), so it's high only when both are high. F-beta weights recall β times as much as precision; F2 suits tasks where missing a positive is worse than a false alarm. For several classes, F1 is computed per class, then averaged: macro treats classes equally, weighted by support, and micro equals accuracy for single-label problems.

Worked example

The defaults are a fraud model with 80 true positives, 20 false positives, 40 false negatives and 860 true negatives. Precision = 80 ÷ 100 = 0.8000, recall = 80 ÷ 120 = 0.6667 and F1 = 0.7273, while F2 is 0.6897. Accuracy looks great at 0.9400, because most cases are easy negatives, but a third of the fraud is missed. For the 3-class matrix example (cat, dog, bird), macro F1 is 0.8719, weighted F1 0.8728 and accuracy 0.8733 over 150 samples.

Checked against scikit-learn

Our tests compare this calculator with scikit-learn's precision_recall_fscore_support, fbeta_score and accuracy_score on 40 random binary cases and 30 random multi-class matrices, and every value matches. Like scikit-learn's default, a class that's never predicted gets precision 0 in the averages.

Frequently asked questions

Which average should I report?

Macro F1 if every class matters equally (including rare ones); weighted F1 if you care about overall performance in proportion to class size. Say which one you used.

Why is F1 better than accuracy for imbalanced data?

F1 ignores true negatives, so a model can't look good just by predicting the majority class.

Is the F1 score calculator free?

Yes. You can open the F1 score calculator and enter all your numbers without signing up. When you calculate for the first time, we ask once for your name and WhatsApp number; after that it, and every other Uncodemy tool, opens straight away.

More free tools

See all free tools