Skip to content
ToolUlkaa Tool
All tools

Machine Learning

TensorFlow PlaygroundConfusion Matrix CalculatorROC Curve and AUC CalculatorK-Means Clustering VisualizerGradient Descent VisualizerDecision Tree BuilderClassifier PlaygroundPCA VisualizerActivation Function Plotter

Categories

AcademicTextMathematicsStatisticsMachine LearningAIData ScienceFile
All tools
Machine Learning

Confusion Matrix From Actual and Predicted Labels

Paste the true labels and the predictions and get the matrix and its metrics.

Input
One per line or separated by commas.
Same order and same number as the actual labels.
2 favours recall, 0.5 favours precision.

Accuracy

0.8333

83.3% of all 12 predictions were correct. If one class is rare, accuracy can look high even when the model misses it, so read recall and MCC too.

Accuracy
0.8333
Balanced accuracy
0.8286
MCC
0.6571
Cohen's kappa
0.6571
Macro F1
0.8286
Total
12

Per-class metrics

ClassTPFPFNTNSupportPrecisionRecallSpecificityF1F-beta (1)
ham611470.85710.85710.80.85710.8571
spam411650.80.80.85710.80.8

Confusion matrix from your labels

Actual \ Predictedhamspam
ham61
spam14

Working

  1. 1Accuracy
    correcttotal\frac{\text{correct}}{\text{total}}totalcorrect​
    ↓
    1012=0.8333\frac{10}{12} = 0.83331210​=0.8333

    Correct predictions are the diagonal of the matrix.

Formulas

Accuracy

accuracy=TP+TNTP+TN+FP+FN\text{accuracy} = \frac{TP+TN}{TP+TN+FP+FN}accuracy=TP+TN+FP+FNTP+TN​

Precision

precision=TPTP+FP\text{precision} = \frac{TP}{TP+FP}precision=TP+FPTP​

Recall (sensitivity)

recall=TPTP+FN\text{recall} = \frac{TP}{TP+FN}recall=TP+FNTP​

Specificity

specificity=TNTN+FP\text{specificity} = \frac{TN}{TN+FP}specificity=TN+FPTN​

F1 score

F1=2PRP+RF_1 = \frac{2PR}{P+R}F1​=P+R2PR​

F-beta score

Fβ=(1+β2) PRβ2P+RF_\beta = \frac{(1+\beta^2)\,PR}{\beta^2 P + R}Fβ​=β2P+R(1+β2)PR​

MCC

MCC=TP⋅TN−FP⋅FN(TP+FP)(TP+FN)(TN+FP)(TN+FN)\mathrm{MCC} = \frac{TP\cdot TN - FP\cdot FN}{\sqrt{(TP+FP)(TP+FN)(TN+FP)(TN+FN)}}MCC=(TP+FP)(TP+FN)(TN+FP)(TN+FN)​TP⋅TN−FP⋅FN​

Cohen's kappa

κ=po−pe1−pe\kappa = \frac{p_o - p_e}{1-p_e}κ=1−pe​po​−pe​​

Balanced accuracy

1K∑k=1Krecallk\frac{1}{K}\sum_{k=1}^{K}\text{recall}_kK1​∑k=1K​recallk​
  1. Tools
  2. Machine Learning
  3. Confusion Matrix Calculator
  4. Confusion Matrix From Actual and Predicted Labels

About Confusion Matrix From Actual and Predicted Labels

This tool builds a confusion matrix from two pasted lists, the actual labels and the predicted labels, and then calculates accuracy, precision, recall, F1, MCC and kappa. It is free, needs no sign-up and runs in your browser, so nothing you enter is uploaded.

Labels can be words or numbers, separated by commas, new lines, tabs or semicolons. The two lists must have the same length and be in the same order, so that the first actual label is paired with the first prediction. Classes are sorted alphabetically or numerically to give the matrix a stable order.

The preloaded example has twelve emails. Five are really spam and the filter flags five emails as spam, but not the same five: it catches four, misses one, and wrongly flags one genuine message.

How to use Confusion Matrix From Actual and Predicted Labels

  1. 1Choose "Matrix counts" and set the number of classes, or choose "Actual and predicted labels" and paste the two lists.
  2. 2In matrix mode, rows are the actual class and columns the predicted class. Edit the cells and the class names.
  3. 3Pick the headline metric: accuracy, precision, recall, specificity, F1, F-beta, MCC, kappa or balanced accuracy.
  4. 4For precision, recall and F-scores, choose which class counts as positive. With two classes the first class is the positive one.
  5. 5Read the headline value and its explanation, then scroll to the per-class table, the averages and the worked steps.
  6. 6Use the copy button to take the metrics into your notes or report.

Features

  • Binary and multi-class matrices up to 8 classes, or up to 12 classes built from pasted labels.
  • Accuracy, precision, recall, specificity, F1, F-beta, MCC, Cohen's kappa and balanced accuracy in one place.
  • Per-class true positive, false positive, false negative and true negative counts.
  • Macro, micro and weighted averages for multi-class problems, so you can see how each differs.
  • Worked steps with your numbers substituted into every formula, and the formulas rendered in LaTeX.
  • A ratio with a zero denominator is shown as n/a instead of a misleading 0.
  • Plain-English reading of the headline metric, including a warning about accuracy on imbalanced data.
  • Editable class names, so the output reads like your own problem.

Worked examples

  • actual: spam, spam, ham, ham ... predicted: spam, ham, ham, ham ... → gives a 2 x 2 matrix built for you

    Each pair adds one to the cell for its actual row and predicted column.

Privacy: how it works

  • The matrix and labels you enter are processed by code running in your browser tab. They are not sent to Ulkaa or anyone else.

Tips

  • Do not rely on accuracy alone when one class is much rarer than the others. Check recall for that class and the MCC.
  • Precision and recall trade against each other. Moving a classifier's decision threshold raises one and lowers the other; the ROC and AUC calculator shows the whole trade-off.
  • F1 gives equal weight to precision and recall. Use F-beta with beta above 1 when missing a positive is worse than a false alarm, and below 1 when the reverse is true.
  • A metric with an empty denominator, such as precision for a class never predicted, is shown as n/a and left out of macro averages.

Frequently asked questions

Is it really free?

Yes. There is no price, no trial and no credit card. Ulkaa Tool does the work with your own device, so there is no server bill to pass on to you.

Do I need an account?

No. There is no sign-up and no login. Open the page and use it. An Ulkaa account is not needed for anything on this tool.

Does it run in my browser?

Yes. Your matrix and labels are processed by code running in your browser tab, on your own device.

Is my data uploaded?

No. Your matrix and labels are never sent to Ulkaa or to anyone else. You can check this yourself by watching the Network tab in your browser developer tools while you use the tool.

How do I make a confusion matrix from two lists?

Count, for every pair of actual and predicted label, how many items fall in it. This tool does that automatically when you paste both lists.

What if my lists have different lengths?

The tool reports an error with both counts, because every prediction needs a matching true label.

More Confusion Matrix Calculator pages

  • Confusion Matrix CalculatorEnter a confusion matrix, or paste actual and predicted labels, and get every classification metric with the working.
  • Precision and Recall CalculatorEnter your confusion matrix to get precision and recall with the formula worked through.
  • F1 Score CalculatorGet the F1 score of a classifier from its confusion matrix, with every step shown.
  • Classification Accuracy CalculatorWork out accuracy from a confusion matrix and see when it misleads.
  • MCC Calculator (Matthews Correlation Coefficient)Compute the MCC of a classifier from its confusion matrix, with the formula substituted.
  • Cohen's Kappa CalculatorMeasure agreement beyond chance between two raters or between a model and the truth.
  • Sensitivity and Specificity CalculatorEnter a test's counts to get sensitivity (recall) and specificity, with the working shown.
  • F-beta Score CalculatorChoose beta to weight recall or precision more, and get the F-beta score with its working.
  • Balanced Accuracy CalculatorAverage the recall of every class so a rare class counts as much as a common one.
  • Multi-class Confusion Matrix CalculatorScore a classifier with three or more classes, class by class and on average.

Ulkaa Apps

  • Ulkaa
  • Calendar
  • Task
  • Note
  • Disk
  • Call
  • Contact
  • Mail
  • Finance
  • Health
  • Office
  • Work
  • Workspace
  • Halum
  • Jaal
  • Islam
  • Game
  • Weather
  • Campus
  • News
  • Developer
  • Help
  • Account
About·Privacy·Terms·© 2026 Ulkaa

What is Ulkaa Tool?

Ulkaa Tool is a free collection of fast, privacy-friendly online tools from Ulkaa Network. Calculate your GPA and CGPA, edit rich text, count words and characters, replace text and more — all in your browser.

Every tool runs entirely in your browser — no sign-up, and your data never leaves your device.

Academic

  • GPA Calculator
  • CGPA Calculator
  • Citation Generator
  • Quiz Maker

Text

  • Rich Text Editor
  • Word Counter
  • Character Counter
  • Text Replacement

Ulkaa

  • Ulkaa
  • Ulkaa News
  • Ulkaa Campus
  • Ulkaa Tool
  • Ulkaa Game
  • Ulkaa Weather
  • Ulkaa Islam

Company

  • About Ulkaa
  • Careers
  • Support
  • Help
  • Privacy Policy
  • Terms of Service
  • Disclaimer
  • Sitemap

© 2015-26, Ulkaa. All rights reserved.
Facebook PageLinkedIn CompanyX (Twitter) ProfileInstagram ProfileGitHub Account