Free tool · browser-only calculation
Confusion matrix calculator: precision, recall, F1, MCC
Calculate binary and multiclass metrics with an editable matrix, macro, micro and weighted averages, F-beta and MCC. With guided examples and shareable.
How the calculation works
Formula as plain text
P=\frac{TP}{TP+FP},\quad R=\frac{TP}{TP+FN},\quad F_\beta=(1+\beta^2)\frac{PR}{\beta^2P+R}A confusion matrix separates correct outcomes from errors. In the binary case, precision measures how many predicted positives are correct, recall how many real positives are found and specificity how many negatives are recognised. Accuracy covers the total and balanced accuracy averages recall across classes.
F1 is the harmonic mean of precision and recall; F-beta changes recall’s relative weight. MCC uses every cell and remains informative under imbalance. In multiclass mode, the diagonal contains correct predictions and off-diagonal cells show class confusion.
Macro averages weight classes equally, micro aggregates cells and weighted averages use support. Colours make errors visible and each metric links to the glossary. The included example lets you verify the calculations before using your own data.