Data Science & ML
Intermediate

Specificity

Of all actual negatives, the fraction correctly identified.

Formula

Specificity=TNTN+FPSpecificity = \frac{TN}{TN + FP}

Live Calculator

Members

Variables

TNTrue negatives
FPFalse positives

Example

TN=90, FP=10: Specificity = 0.90

How it works

Specificity measures how well a model avoids false alarms among the cases that are truly negative. It is calculated as TN divided by all actual negatives (TN + FP), so it answers: "If the true class is negative, how often does the model correctly say negative?" This works because the denominator counts every actual negative case, while the numerator counts only the ones the model got right.

When to use it

Use specificity when false positives matter, such as in medical screening, fraud detection, spam filtering, or any test where incorrectly flagging a negative case has a cost. It is especially useful when you want to know how reliably a model leaves normal or non-target cases alone.

Worked example, step by step

Suppose a diagnostic model is tested on 200 people who do not have the condition. Of these, 170 are correctly predicted as negative (TN = 170). The model incorrectly labels 30 healthy people as positive (FP = 30). Specificity = TN / (TN + FP) Specificity = 170 / (170 + 30) Specificity = 170 / 200 Specificity = 0.85 So, the model's specificity is 0.85, or 85%.

Common mistakes to avoid

  • Using true positives instead of true negatives in the numerator
  • Dividing by all predictions instead of only actual negatives
  • Confusing specificity with sensitivity, which measures how well positives are detected

Did You Know?

Specificity is the true negative rate, complementary to recall.

Share this formula

Reviewed & maintained by the FormulaWon editorial teamLast reviewed September 2026