Accuracy Calculator

Accuracy calculator

Evaluate diagnostic-test accuracy or measurement percent error with transparent formulas and live validation.

Method: Standard Accuracy: 85.00% Valid example
Example workbook is ready.

Inputs

Choose the formula that matches your data and study design.

Non-negative whole count correctly classified as positive.

Non-negative whole count of positive cases missed by the test.

Non-negative whole count incorrectly classified as positive.

Non-negative whole count correctly classified as negative.

Live results

Accuracy
85.00%

(80 + 90) ÷ (80 + 20 + 10 + 90) = 85.00%

Sensitivity
80.00%
Specificity
90.00%
Accuracy 85.00 percent. Sensitivity 80.00 percent. Specificity 90.00 percent.

Confusion matrix

Actual class Predicted positive Predicted negative Row total
Actual positive 80 20 100
Actual negative 10 90 100
Total 90 110 200
The matrix is shown only when count data are part of the active calculation. It is a direct tabular view of the same validated inputs used by the formulas and Excel workbook.

How to use this accuracy calculator

What this calculator does

This calculator measures accuracy in three distinct ways. The Standard diagnostic accuracy method uses a 2×2 confusion matrix and reports the share of all cases classified correctly. The Accuracy based on prevalence method combines sensitivity, specificity, and population prevalence when the case mix in a study should not be treated as the population prevalence. The Percent error method compares one observed measurement with an accepted reference value. These are mathematical summaries, not a clinical diagnosis or a complete assessment of model quality. In particular, high diagnostic accuracy can be misleading when one class is much more common than the other.

Use this tool when you are checking a diagnostic-test dataset, comparing a test's expected performance at a different prevalence, auditing a binary classifier, or quantifying how far a measurement is from a trusted reference. For measurement terminology, NIST defines accuracy in relation to closeness to a true or accepted reference value; see the NIST accuracy definition.

How to calculate

  1. The calculator opens with a ready-to-use diagnostic example: 80 true positives, 20 false negatives, 10 false positives, and 90 true negatives. The example result and a validated Excel workbook are available immediately.
  2. Choose Select a method. For standard accuracy, replace the four count values. For prevalence-based accuracy, enter Prevalence, Sensitivity, and Specificity, or enable Show confusion matrix and enter the four counts so the rates are derived automatically. For percent error, replace Observed value and Accepted value.
  3. Read the live Headline result. Depending on the method it is labeled Accuracy or Percent error. The two secondary result cards are Sensitivity and Specificity when those rates are part of the active diagnostic method. Count-based methods also show the confusion matrix table.
  4. Select Download Excel to export the current validated inputs and results. Select Reset to clear the demonstration and all data fields. Reset intentionally does not restore the sample; it leaves an empty neutral state and disables Excel export until a complete valid input set is entered again.

Input guide

Select a method is required and determines the formula. True positive, False negative, False positive, and True negative are required non-negative whole-number counts whenever a confusion matrix is active. Grouped integers such as 1,000 are accepted; decimals, scientific notation, and negative counts are rejected. At least one actual-positive and one actual-negative case are required so sensitivity and specificity remain defined. Increasing true positives or true negatives generally raises standard accuracy; increasing false positives or false negatives lowers it. A common mistake is swapping false positives and false negatives.

Prevalence, Sensitivity, and Specificity are percentages from 0% through 100%. You may enter 30 or 30% to mean 30%. Prevalence is the proportion of the target population with the condition. Sensitivity is the true-positive rate, and specificity is the true-negative rate. The NCBI's overview of sensitivity and specificity explains those rates with a practical diagnostic example. Higher sensitivity has more influence when prevalence is high, while higher specificity has more influence when prevalence is low. Do not enter 0.80 when you mean 80%; this interface expects percentage points.

Show confusion matrix is optional in the prevalence method. When selected, the separate prevalence-method true/false positive and negative fields become required, and the calculator derives sensitivity as TP ÷ (TP + FN) and specificity as TN ÷ (TN + FP). Observed value is a required finite decimal for the measurement method. Accepted value is the required positive, nonzero reference value in the same unit. Period decimals are accepted; comma decimals and scientific notation are rejected to avoid ambiguous interpretation. For example, 95 and 97.8 are valid values in the same temperature unit.

Output guide

The Headline result is a percentage. In both diagnostic methods it is Accuracy: the expected proportion of correct classifications. In percent-error mode it is Percent error: the absolute measurement deviation divided by the accepted value. Zero diagnostic accuracy means no cases were classified correctly, while 100% means every case was correct. Zero percent error means the observed and accepted values are identical; larger percent error means a larger relative deviation. The Secondary result A and Secondary result B cards are labeled Sensitivity and Specificity when applicable. They describe positive-case detection and negative-case rejection, respectively.

The Confusion matrix table is an exact organization of the active count inputs: actual-positive cases contain true positives and false negatives, actual-negative cases contain false positives and true negatives, and the margins show row, prediction, and grand totals. For background on why accuracy can be deceptive with imbalanced classes, the NCBI prediction-modeling methodology chapter discusses accuracy and confusion-matrix metrics.

Worked example

The startup example has TP = 80, FN = 20, FP = 10, and TN = 90. There are 200 cases in total and 170 correct classifications. Standard accuracy is therefore (80 + 90) ÷ (80 + 20 + 10 + 90) = 170 ÷ 200 = 85.00%. Sensitivity is 80 ÷ (80 + 20) = 80.00%, and specificity is 90 ÷ (90 + 10) = 90.00%. These are the same values shown on first open and written to the startup Excel workbook.

How the formulas differ

Standard accuracy: (TP + TN) ÷ (TP + TN + FP + FN)

Standard accuracy uses the sample's observed class mix. It is appropriate when that mix is meaningful for the population or decision context. Sensitivity is TP ÷ (TP + FN); specificity is TN ÷ (TN + FP).

Prevalence-based accuracy: sensitivity × prevalence + specificity × (1 – prevalence)

In the prevalence method, percentages are converted internally to proportions before multiplication. This formula weights the true-positive rate by how often positive cases occur and the true-negative rate by how often negative cases occur. The resulting percentage can change substantially as prevalence changes, even if the entered sensitivity and specificity are held constant.

Percent error: |observed – accepted| ÷ accepted × 100%

Percent error is a relative measurement error, not a confusion-matrix accuracy score. Because the numerator uses an absolute difference, values above and below the accepted reference produce the same error magnitude at the same distance. The accepted value must be positive and nonzero so the percentage is defined.

Accuracy is useful, but context matters

For diagnostic tests and classifiers, accuracy compresses several kinds of outcomes into one number. That is convenient, but it can hide the difference between false negatives and false positives. When the positive class is rare, a classifier that predicts almost everything as negative may have a high overall accuracy while offering poor sensitivity. Review sensitivity, specificity, prevalence, and the confusion matrix together when the consequences of the two error types differ.

This calculator provides mathematical estimates for education and analysis. It does not replace clinical validation, calibration procedures, domain-specific standards, or professional judgment.