Statistics

Confusion Matrix Calculator

Evaluate a binary classifier with accuracy, precision, recall, specificity and F1 from four outcome counts.

Data stays on this deviceConvention explained below
Data explorer
Data explorer

Check the dataset and sample convention before interpreting results.

See the method

Add your observations

Runs on your device

Your statistical summary

Your result

Let’s calculate.

Use the Calculate button to see your result.

Review the method below for assumptions and conventions.

How to use this tool

  1. Enter true positives, false positives, false negatives, true negatives.
  2. Select Calculate to view the result.
  3. Check the method and assumptions below before using the result.

Input reference and sample values

Use the units and choices shown for each field. Sample values are provided for practice, not as recommendations.

InputFormat and unitsSample
True positivesWhole numbers only. Zero or positive. Maximum: 1000000.80
False positivesWhole numbers only. Zero or positive. Maximum: 1000000.10
False negativesWhole numbers only. Zero or positive. Maximum: 1000000.20
True negativesWhole numbers only. Zero or positive. Maximum: 1000000.90

Result for these sample inputs

0.85 probability
Precision
0.888888889
Recall / sensitivity
0.8
Specificity
0.9
F1 score
0.842105263
Total outcomes
200

Scores are fractions from 0 to 1. Accuracy alone can hide poor performance on an imbalanced dataset.

Select Try the example in the form to load these values and calculate them again. This replaces the current form inputs. Compare the result with the method and worked explanation below.

The method, explained

Accuracy = (TP+TN)/N. Precision = TP/(TP+FP). Recall = TP/(TP+FN). Specificity = TN/(TN+FP). F1 = 2TP/(2TP+FP+FN).

A WORKED EXAMPLE

Using true positives = 80, false positives = 10, false negatives = 20, true negatives = 90, the result is 0.85 probability. Change these example inputs to match your task; use the method above to check each step.

What to keep in mind

Binary labels only. Counts must come from the same evaluation set and decision threshold. This page does not diagnose medical conditions. A descriptive or probability calculation under the stated assumptions. Check the sample design and model before interpreting results.

Reference: NIST: statistical methods handbook

Common questions

What is the difference between precision and recall?

Precision asks how many predicted positives were actually positive. Recall asks how many actual positives were found. Their denominators differ, so one can be high while the other is low.

Why can a score be undefined?

A metric cannot be calculated when its denominator is zero. For example, precision is undefined if the model predicts no positive cases. The page labels this rather than silently substituting zero.

Methodology maintained by ClarityKit. How these tools are built and checked.