Z-score

Also known as: standard score

On this page 7

A z-score, also called a standard score, measures how many standard deviations a single observation lies above or below the mean of its distribution. In statistics, the z-score converts raw values into a dimensionless, common scale, so that a test result, a sensor reading and a transaction amount can be compared or screened with the same rule.

A positive z-score indicates a value above the mean, a negative one a value below it, and a z-score of zero equals the mean exactly. The transformation is simple, but its interpretation depends heavily on the shape of the underlying distribution and on whether the mean and standard deviation are known or estimated from data.

How the z-score is calculated

The z-score subtracts the mean from a value and divides the difference by the standard deviation: z = (x - μ) / σ. The subtraction centers the data on zero and the division rescales it so that one unit equals one standard deviation. Applying this to every value of a variable is called standardization.

In practice, the population parameters μ and σ are rarely known, so analysts use the sample mean and sample standard deviation instead: z = (x - x̄) / s. Strictly speaking this produces a studentized value, but the term z-score is used for both in everyday work. The table below defines each element of the formula.

SymbolMeaningEffect on the result
xThe observed valueLarger values give higher z-scores
μ or x̄Population or sample meanSets the zero point of the scale
σ or sPopulation or sample standard deviationSets the size of one unit
zStandardized valueUnitless distance from the mean
Elements of the z-score formula

Standardized variables always have a mean of 0 and a standard deviation of 1. Standardization is a linear transformation, so it changes location and scale but never changes the shape of the distribution: a skewed variable stays exactly as skewed after conversion.

Interpreting z-scores under the normal distribution

When data follow a normal distribution, each z-score maps to a precise cumulative probability, which is why standardized values are so useful. The standard normal distribution has mean 0 and standard deviation 1, and its tables convert a z-score directly into a percentile or tail probability.

The following table lists commonly used reference values and their meaning for normally distributed data.

Z-scoreShare of values between plus and minus zTypical use
±1.00About 68.3%Typical spread of ordinary values
±1.64590%One-sided 5% significance threshold
±1.9695%Two-sided 95% confidence intervals
±2.57699%Strict two-sided tests
±3.00About 99.7%Common outlier screening threshold
Reference z-scores for a normal distribution

These figures restate the familiar 68-95-99.7 rule. A z-score of 2 therefore places a value at roughly the 97.7th percentile, and only about 0.3% of normal values fall outside three standard deviations. For non-normal data these percentages do not hold; Chebyshev’s inequality guarantees only that at most 1/k² of any distribution lies beyond k standard deviations, which is 11.1% for k = 3.

Z-scores compared with other standardized measures

A z-score is one of several ways to express a value’s relative position, and each alternative answers a slightly different question. Choosing the wrong one is a frequent source of misleading conclusions, especially with skewed or heavy-tailed data.

MeasureBased onRobust to outliersBest suited for
Z-scoreMean and standard deviationNoRoughly normal data
Modified z-scoreMedian and median absolute deviationYesOutlier detection in skewed data
Percentile rankOrdered valuesYesAny distribution, ordinal ranking
T-scoreZ-score rescaled to mean 50, SD 10NoPsychometric and clinical reporting
Min-max scalingObserved minimum and maximumNoBounding features to 0 to 1
Z-score versus related measures of relative position

The modified z-score replaces the mean with the median and the standard deviation with the scaled median absolute deviation, so a single extreme value cannot inflate the scale and hide itself. A widely used rule flags values with a modified z-score above 3.5 as potential outliers. The percentile rank carries no distributional assumption at all, but it discards information about how far apart values are.

Practical uses of the z-score

Z-scores are used wherever values on different scales must be compared or where unusual observations must be detected with a consistent rule. Typical applications appear across analytics, machine learning and quality management.

  • Outlier detection: values with an absolute z-score above 3 are flagged for review in monitoring and data cleaning.
  • Feature scaling: many machine learning algorithms, such as k-means, support vector machines and regularized regression, perform better when inputs are standardized.
  • Comparing scores: results from tests with different scales become comparable once each is expressed relative to its own group.
  • Hypothesis testing: the z-test statistic divides the difference between an estimate and a hypothesized value by its standard error.
  • Process control: control charts set limits at three standard deviations, which is a z-score boundary.

The decision table below shows how to choose an approach for common analytic situations.

SituationRecommended approachReason
Symmetric data, large sampleClassical z-scoreMean and SD are stable estimates
Skewed transaction amountsLog transform, then z-scoreReduces skew before standardizing
Small sample with extreme valuesModified z-scoreMedian-based scale resists outliers
Model training and servingZ-score with stored training parametersPrevents leakage and drift
Choosing a standardization approach

Limitations and common mistakes

The z-score is easy to compute but easy to misread. Most errors come from assuming normality or from computing the mean and standard deviation on the wrong data.

  • Masking effect: extreme values inflate the standard deviation, which lowers their own z-scores and can hide them below a threshold of 3.
  • Skewed data: in a right-skewed variable such as income, a z-score of 2 does not correspond to the 97.7th percentile.
  • Small samples: with few observations the maximum possible absolute z-score is bounded; with n = 10 it cannot exceed about 2.85, so a threshold of 3 never triggers.
  • Data leakage: standardizing a full dataset before splitting it lets test information influence training; parameters must come from the training set only.
  • Mixed populations: pooling distinct groups, such as weekday and weekend traffic, produces a mean that describes neither.

A z-score also says nothing about practical importance. A value two standard deviations above the mean may be trivial in business terms when the spread is tiny, so standardized results should always be read alongside the original units.

The idea in brief

A z-score tells you how unusual a number is compared with the rest of its group. Instead of saying a student scored 82 points, it says the student scored one and a half steps above the class average, where a step is the typical distance of scores from that average.

This makes very different things comparable. A score of 82 in a hard exam and 95 in an easy one can be put on the same scale. As a rough guide, a z-score near zero is ordinary, around two is uncommon, and beyond three is rare enough to deserve a closer look.

A practical scenario

A data team at a regional energy utility monitors hourly electricity consumption from about 40,000 smart meters. Absolute thresholds failed because a large household and a small apartment have very different normal levels, so the team computes a z-score for each meter against its own history for the same hour and weekday over the past eight weeks.

Because consumption is right-skewed, the analysts first apply a log transformation and then use the modified z-score based on the median, which keeps a single past spike from distorting the baseline. Readings with an absolute modified z-score above 3.5 are routed to a review queue.

In the first quarter the system flagged around 120 meters per week instead of thousands under the old fixed limits. Field checks confirmed faulty meters, unreported tampering and several water heaters stuck on, and the team reduced manual review time by about two thirds while finding more genuine problems.