F1 Score and Confusion Matrix Calculator

Compute accuracy, precision, recall, F1, MCC, and more from a confusion matrix. Visualise results with a colour-coded heatmap and metric comparison chart.

Please verify you are human to use the calculator.

How Classification Metrics Work

Build the Confusion Matrix

Enter the four counts — true positives, false positives, false negatives, and true negatives — or paste raw predictions to have them computed automatically.

Precision, Recall & F1 Score

Precision measures how many predicted positives are correct. Recall measures how many actual positives are found. F1 balances both via the harmonic mean.

MCC & Cohen's Kappa

These metrics account for class imbalance. MCC uses all four matrix cells; Cohen's kappa measures agreement beyond chance. Both are more robust than accuracy alone.

Visual Comparison

The colour-coded confusion matrix heatmap shows the distribution of predictions at a glance, while the bar chart makes it easy to compare all metrics side by side.

Understanding Classification Performance

Evaluating a classifier goes far beyond a single accuracy number. Different metrics illuminate different aspects of model performance, and the right choice depends on the problem domain and the relative cost of errors.

In medical diagnosis, missing a true positive (low recall) could be life-threatening, so recall is paramount. In spam filtering, marking a legitimate email as spam (low precision) is highly disruptive, so precision matters more. The F1 score offers a balanced view, while MCC and Cohen's kappa provide single numbers that are robust to class imbalance.

These metrics are fundamental to machine learning workflows. For a hands-on example of building a text classifier and evaluating it with a confusion matrix, see our tutorial on text classification with TF-IDF and Naive Bayes.

Related Tools

Stay in the loop

Get notified when new tutorials and deep-dives are published. No spam, unsubscribe anytime.

Classification Metrics FAQ

Common questions about confusion matrices and classification evaluation