Accuracy Calculator

Calculate accuracy, precision, recall, F1, MCC from a confusion matrix. Also computes measurement error metrics (MAE, RMSE, MAPE) and simple proportion accuracy with confidence intervals.

Accuracy Calculator

Confusion Matrix

Predicted +Predicted −
Actual +
Actual −
Accuracy
98.50%
(TP+TN)/N = (90+895)/1000
Precision (PPV)
90.00%
TP / (TP + FP) — of predicted positive, how many are correct
Recall (Sensitivity)
94.74%
TP / (TP + FN) — of actual positive, how many detected
Specificity (TNR)
98.90%
TN / (TN + FP) — of actual negative, how many detected
F1 Score
0.9231
Harmonic mean of precision and recall
MCC
0.9151
Matthews correlation coefficient (−1 to +1)

Extended Metrics

MetricValue
Balanced Accuracy96.82%
Prevalence9.50%
False Positive Rate1.10%
Negative Predictive Value99.44%
95% CI[97.75%, 99.25%]
Standard Error0.0038

Visual: Confusion Matrix

TP: 90
FN: 5
FP: 10
TN: 895
Planning notes, formulas, and examples

About the Accuracy Calculator

Accuracy measures closeness to the truth, but the exact meaning depends on the task. In classification, accuracy is the share of correct predictions. In measurement, it describes how close observed values are to the true or reference values. This calculator covers both contexts, plus a simple correct-versus-total proportion mode.

For classification, you can enter a confusion matrix and get accuracy, precision, recall, specificity, F1 score, Matthews correlation coefficient, and related diagnostics. For measurement problems, you can enter paired actual and measured values to compute MAE, RMSE, MAPE, R², and other error summaries.

That makes the page useful for model evaluation, diagnostic testing, quality-control checks, and any workflow where one overall accuracy number is not enough on its own.

When This Page Helps

A single accuracy percentage can hide important failure modes. In imbalanced classification, a model can score highly while missing the class you actually care about. In measurement work, a low average error can still conceal occasional large misses.

This calculator puts the supporting metrics next to the headline number so you can see whether the result reflects balanced performance, bias, spread, or some mix of the three.

How to Use the Inputs

  1. Select the accuracy type: classification, measurement, or simple proportion.
  2. For classification, enter TP, FP, FN, TN in the confusion matrix.
  3. For measurement, enter comma-separated actual and measured values.
  4. For simple accuracy, enter the count of correct outcomes and total count.
  5. Set the confidence level for the interval.
  6. Review all accuracy metrics and confidence intervals.
  7. Check the visual confusion matrix or error distribution table.
Formula used
Classification Accuracy = (TP + TN) / (TP + FP + FN + TN) Precision = TP / (TP + FP) Recall (Sensitivity) = TP / (TP + FN) Specificity = TN / (TN + FP) F1 = 2 × Precision × Recall / (Precision + Recall) MCC = (TP×TN − FP×FN) / √((TP+FP)(TP+FN)(TN+FP)(TN+FN)) MAE = (1/n) Σ|yᵢ − ŷᵢ| RMSE = √((1/n) Σ(yᵢ − ŷᵢ)²) MAPE = (100/n) Σ|yᵢ − ŷᵢ|/|yᵢ|

Example Calculation

Result: Accuracy = 98.50%, F1 = 0.923

With 90 true positives, 10 false positives, 5 false negatives, and 895 true negatives out of 1,000 observations, accuracy is 98.5%. Precision is 90% (90/100), recall is 94.7% (90/95), and F1 score is 0.923. MCC is 0.909, indicating excellent classification performance.

Tips & Best Practices

  • With imbalanced classes (e.g., 99% negative), accuracy can be misleadingly high. Use balanced accuracy, F1, or MCC instead.
  • F1 score is the harmonic mean of precision and recall — it penalizes extreme imbalance between the two.
  • MCC ranges from −1 to +1: +1 is perfect, 0 is random, −1 is complete disagreement. It's considered the most informative single metric for binary classification.
  • For measurement accuracy, RMSE penalizes large errors more than MAE due to squaring.
  • MAPE can be infinite or misleading when actual values are near zero — use MAE or RMSE instead.
  • The confidence interval width depends on both accuracy and sample size — larger samples give tighter intervals.

Accuracy in Classification vs Measurement

Classification accuracy counts discrete correct/incorrect predictions. Measurement accuracy quantifies how close continuous predictions are to true values. The metrics differ fundamentally: classification uses counts (TP, FP, FN, TN) while measurement uses deviations (errors). Both are called "accuracy" but require different evaluation frameworks.

The Accuracy Paradox

In a dataset where 99% of samples are negative, a classifier that always predicts "negative" achieves 99% accuracy. This is the accuracy paradox — high accuracy despite useless predictions. Balanced accuracy, F1, and MCC all address this by accounting for both positive and negative class performance.

Practical Considerations for Model Evaluation

Always report multiple metrics. No single number captures all aspects of performance. Pair accuracy with precision/recall for classification, or MAE with MAPE for measurement. Use confusion matrix visualization to identify specific error patterns. Consider the costs of different error types in your domain.

Sources & Methodology

Last updated:

Frequently Asked Questions

  • Accuracy is the overall proportion of correct predictions (both positive and negative). Precision is the proportion of positive predictions that are actually positive. With a rare disease, a test that always says "negative" has high accuracy but zero precision.