Accuracy Calculator

Compute classification accuracy from y_true and y_pred.

FreeNo accountOn your device

Runs in your browser. How to verify

Loading tool…

About this tool

Paste the true labels and the predicted labels and get classification accuracy: the share of predictions that match. The result also lists the labels and the confusion matrix rows so you can see where the errors are.

How to use

1
Step 1
Paste y_true, one label per line.
2
Step 2
Paste y_pred in the same order.
3
Step 3
Press Calculate.

How it works

Accuracy = number of correct predictions ÷ total predictions. It is easy to read but misleading for imbalanced classes: predicting the majority class every time can score 95% when the minority class is 5% of the data. Check precision, recall and F1 as well.

accuracy = (TP + TN) / total   (for any number of classes: correct ÷ n)

Worked example

Three right out of five

Input
y_true: cat, cat, dog, dog, dog y_pred: cat, dog, dog, dog, cat
Output
Accuracy 0.6; support 5
Walkthrough
Positions 1, 3 and 4 match, so 3 / 5 = 0.6.

Limitations

  • Accuracy hides class imbalance; use F1 for skewed data.
  • Lists must have equal length.
  • Labels are compared as exact text.

Questions

How do I calculate accuracy?
Divide the number of correct predictions by the total. The tool does this from two label lists.
Is 90% accuracy good?
It depends on the class balance. If 90% of samples are one class, a model that always predicts it scores 90%.
What is the difference between accuracy and F1?
Accuracy counts all correct predictions; F1 balances precision and recall for each class.
Does it give a percentage?
The result is a fraction, so 0.6 means 60%.

Features

  • Accuracy from labels
  • Support and matrix rows
  • Runs in your browser

Related resources

Guides and videos from around the web—opens on YouTube or the publisher’s site.

  • Vectors | Essence of linear algebra

    3Blue1Brown

    Embeddings and vectors start with linear algebra intuition.

    Watch on YouTube
  • Big-O Notation in 100 Seconds

    Fireship

    Complexity intuition when estimating training/inference cost.

    Watch on YouTube
  • DeepLearning.AI

    DeepLearning.AI

    Courses and explainers for modern AI tooling.

  • OpenAI Research

    OpenAI

    Research notes for people exploring AI tooling trends.