Confusion Matrix Calculator
Calculate accuracy, precision, recall, specificity and F1 from a confusion matrix of true/false positives and negatives.
Last reviewed by the Radiatus Cloud team
Calculate classification metrics from a confusion matrix.
Securing AI in production?
We build guardrails, governance & compliance for AI systems.
Calculate metrics from a confusion matrix
A confusion matrix summarises the performance of a binary classifier with four counts: true positives, false positives, false negatives and true negatives. This calculator derives the key metrics from those counts: accuracy, the overall fraction correct; precision, the reliability of positive predictions; recall or sensitivity, the fraction of actual positives found; specificity, the fraction of actual negatives correctly rejected; and the F1 score, which balances precision and recall.
Seeing all these metrics together gives a far fuller picture of a classifier than accuracy alone.
Reading the metrics
Each metric answers a different question. Precision matters when false positives are costly, such as flagging legitimate email as spam, while recall matters when missing a positive is costly, such as failing to detect a disease. Specificity complements recall by focusing on the negative class. On imbalanced data, accuracy can look high while the model performs poorly on the minority class, which is exactly where precision, recall and F1 reveal the truth.
Use the full set of metrics to choose a model and a decision threshold that fit the real costs of each type of error. All calculation happens locally in your browser.
Related tools
- AI Prompt Leakage Analyzer — Paste a system prompt and a hostile user input to see whether the prompt holds secrets and whether the input carries injection patterns. Local, instant.
- LLM Data Exposure Checker — Check if text contains data likely to be memorized or exposed by LLMs.
- AI Usage Policy Generator — Generate an acceptable use policy for AI tools in your company.
- Model Hallucination Estimator — Estimate risk of hallucinations based on task type and temperature.
Frequently Asked Questions
What is a confusion matrix?
It is a table of four counts, true and false positives and negatives, that summarises the predictions of a binary classifier against the truth.
What is the difference between precision and recall?
Precision is the fraction of positive predictions that are correct, while recall is the fraction of actual positives the model finds.
What is specificity?
It is the fraction of actual negatives correctly identified as negative, complementing recall which focuses on the positive class.
Why not just use accuracy?
On imbalanced data a model can score high accuracy while failing on the rare class, so precision, recall and F1 give a truer picture.
Privacy & Security
Everything runs in your browser; nothing is uploaded.
How to Use
Enter the four confusion-matrix counts.
Disclaimer: This tool is provided "as is" without warranty of any kind. Results are for educational and utility purposes.
Related Tools
AI Prompt Leakage Analyzer
AI SecurityPaste a system prompt and a hostile user input to see whether the prompt holds secrets and whether the input carries injection patterns. Local, instant.
LLM Data Exposure Checker
AI SecurityCheck if text contains data likely to be memorized or exposed by LLMs.
AI Usage Policy Generator
AI SecurityGenerate an acceptable use policy for AI tools in your company.