Calculate accuracy, true positives, true negatives, or total samples from the other three values in a simple classification accuracy calculator.

Accuracy Calculator

Enter any 3 values to calculate the missing variable


Related Calculators

Accuracy Formula

The accuracy calculator uses the standard classification accuracy formula. Accuracy is the percentage of all samples that were classified correctly.

Accuracy = ((TP + TN) / N) * 100

Rearranged formulas used to solve for a missing value:

TP = (Accuracy / 100 * N) - TN
TN = (Accuracy / 100 * N) - TP
N = (TP + TN) / (Accuracy / 100)
  • Accuracy = percentage of total samples classified correctly
  • TP = true positives, or positive cases correctly classified as positive
  • TN = true negatives, or negative cases correctly classified as negative
  • N = total number of samples

If you enter true positives, true negatives, and total samples, the calculator finds accuracy. If you enter accuracy and any two of the other values, it rearranges the formula to find the missing value.

Accuracy Terms and Result Checks

Term Meaning Counts as correct?
True positive A positive sample predicted as positive Yes
True negative A negative sample predicted as negative Yes
False positive A negative sample predicted as positive No
False negative A positive sample predicted as negative No

The calculator only needs true positives, true negatives, and total samples because the total samples already include both correct and incorrect classifications.

Accuracy result General interpretation What to check
0% to 50% Low accuracy for most classification tasks Check the labels, prediction logic, or class balance
50% to 80% Moderate accuracy Compare with a baseline or random-choice result
80% to 95% High accuracy in many settings Review false positives and false negatives separately
95% to 100% Very high accuracy Check for data leakage, duplicate samples, or an easy dataset

Example Calculations

Example 1: Calculate accuracy

Suppose a model has 42 true positives, 38 true negatives, and 100 total samples.

Accuracy = ((42 + 38) / 100) * 100
Accuracy = 80%

The accuracy is 80%.

Example 2: Calculate true negatives

Suppose accuracy is 90%, true positives are 55, and the total number of samples is 100.

TN = (90 / 100 * 100) - 55
TN = 35

The number of true negatives is 35.

FAQ

What does accuracy measure?

Accuracy measures the share of all samples that were classified correctly. It adds true positives and true negatives, divides by the total number of samples, then converts the result to a percentage.

Can accuracy be misleading?

Yes. Accuracy can be misleading when the classes are imbalanced. For example, if 95 out of 100 samples are negative, a model that predicts every sample as negative can have 95% accuracy while failing to find any positive cases. In that situation, you should also look at precision, recall, sensitivity, specificity, or the full confusion matrix.

Why can the calculator return a decimal count?

Counts such as true positives, true negatives, and total samples are normally whole numbers. A decimal count can appear when the entered accuracy percentage does not match a whole-number sample count exactly. If you are working with real classification results, adjust the inputs so the counts are whole numbers and the total is consistent.