Z score normalization (standardization) transforms data so each value shows how many standard deviations it sits from the mean, giving a distribution with a mean of 0 and a standard deviation of 1. You enter a raw data set, and the calculator returns each point’s z-score plus the normalized value. This makes different scales comparable, which is essential for machine learning, statistics, and lab data analysis.
Formula
For each value x in a dataset, the z-score is:
z = (x − μ) / σ
- x = individual raw value (same unit as the data)
- μ = arithmetic mean of all values (same unit)
- σ = population standard deviation (same unit)
The mean is the sum of all values divided by the count. The population standard deviation is the square root of the average squared deviation from the mean: σ = √( Σ(x − μ)² / N ). If your data is a sample, use the sample standard deviation (divide by N−1) instead; the z-score formula remains the same.
Worked Example
Take the default data: 10, 12, 23, 23, 16, 23, 21, 16.
Step 1 – mean: (10+12+23+23+16+23+21+16) / 8 = 144 / 8 = 18.0
Step 2 – squared deviations from 18: (10−18)² = 64, (12−18)² = 36, (23−18)² = 25, (23−18)² = 25, (16−18)² = 4, (23−18)² = 25, (21−18)² = 9, (16−18)² = 4. Sum = 64+36+25+25+4+25+9+4 = 192.
Step 3 – population variance: 192 / 8 = 24, so σ = √24 ≈ 4.8990.
Step 4 – z-scores: (10−18)/4.8990 ≈ −1.633, (12−18)/4.8990 ≈ −1.225, (23−18)/4.8990 ≈ 1.020, (23−18)/4.8990 ≈ 1.020, (16−18)/4.8990 ≈ −0.408, (23−18)/4.8990 ≈ 1.020, (21−18)/4.8990 ≈ 0.612, (16−18)/4.8990 ≈ −0.408.
Step 5 – check: the mean of these z-scores is 0 (within rounding) and the standard deviation is 1. The calculator shows the mean as 0.0000 and the standard deviation as 1.0000.
Assumptions
- The data is numeric and at least interval scale (equal spacing between values).
- You are using the population standard deviation; for a sample, the z-scores will differ slightly.
- No missing values – each comma-separated number is treated as one observation.
- The transformation preserves the shape of the distribution; it does not make skewed data normal.
When to Use Z Score Normalization
Use z-score normalization when you need to compare values from different scales or when an algorithm assumes features have similar ranges. Common cases:
- Preparing data for PCA, SVM, k-means clustering, or logistic regression without regularization.
- Comparing exam scores from two different tests with different means and spreads.
- Detecting outliers – a z-score beyond ±3 is often considered extreme.
- Combining lab measurements (e.g., absorbance, concentration, time) into a single index.
Unlike min-max scaling (which forces values into 0–1), z-scores keep negative values and preserve the relative distances between points. This is crucial when the distribution is roughly symmetric.
How to Choose: Z-Score vs. Min-Max
Choose z-score when:
- Your data has outliers – min-max is heavily distorted by extreme values.
- You expect the feature to be roughly bell-shaped.
- The algorithm uses distance measures (Euclidean, Manhattan) – z-scores equalize the influence of each dimension.
Choose min-max when:
- You need bounded values, e.g., for image pixels (0–255) or neural networks with sigmoid activation.
- Your data is already in a fixed range and no outliers exist.
A common misconception: z-score normalization makes data normally distributed. It does not. It only changes the mean and spread; the shape (skewness, kurtosis) stays identical. If you need normality, apply a transformation like log or Box-Cox first, then standardize.
Common Mistakes and Pitfalls
- Using sample standard deviation (N−1) when you have the whole population, or vice versa – results differ slightly.
- Forgetting to apply the same mean and standard deviation from the training set to the test set in machine learning. If you recalculate on the test set, you leak information and get invalid performance estimates.
- Mixing up the order: compute the mean and standard deviation first, then subtract and divide. Doing it row-by-row without saving the global statistics is wrong.
- Rounding too early – keep at least 4–5 significant figures during intermediate steps.
Interpreting the Result
A z-score of +1.5 means the value is 1.5 standard deviations above the mean. For a normal distribution, about 68% of values fall between −1 and +1, 95% between −2 and +2, and 99.7% between −3 and +3. So a z-score of 2.5 is unusual (about 1.2% chance if normal). But if your data is not normal, these percentages do not apply – the z-score only tells position relative to the mean, not probability.
Limits and Alternatives
Z-score normalization is not robust to extreme outliers because both the mean and standard deviation are sensitive to them. One extreme value can pull the mean and inflate the standard deviation, making all other z-scores look small. Alternatives:
- Robust scaling: subtract the median and divide by the interquartile range (IQR).
- Rank-based transformation: convert values to percentiles, then to z-scores via the inverse normal CDF.
- Unit vector scaling: divide each row by its Euclidean norm (common in text analysis).
For lab work, always record the original units alongside z-scores – the normalized value is dimensionless, so it has no physical meaning without the original context.
Frequently Asked Questions
What is the difference between z-score and standard deviation? Standard deviation is a measure of spread in the original units; the z-score is a dimensionless number that expresses a single value relative to the mean in units of standard deviation. The z-score is calculated using the standard deviation.
Can z-scores be negative? Yes. Any value below the mean gets a negative z-score. That is normal and expected – the mean of all z-scores is always 0.
Does z-score normalization change the distribution shape? No. It shifts the center and rescales the spread, but the relative shape (skewness, kurtosis) remains exactly the same. If you need normality, apply a nonlinear transformation first.
Should I use population or sample standard deviation? If your data is the entire group you care about (e.g., all students in a class), use population. If it’s a sample from a larger population (e.g., 100 patients out of thousands), use sample standard deviation (N−1). For large samples, the difference is negligible.
What is a good z-score threshold for outliers? A common rule is ±3, which captures about 99.7% of data in a normal distribution. For smaller samples, use ±2.5 or check with a boxplot. Always consider your domain – in quality control, ±3 sigma is standard.
Can I use z-scores for non-normal data? Yes, but interpret carefully. The z-score still tells you how many standard deviations from the mean, but the empirical rule (68-95-99.7) does not apply. For skewed data, a z-score of 2 might be less extreme than it appears.
Related
Formula used
in list | Data values (comma separated) | 10, 12, 23, 23, 16, 23, 21, 16 | 0 out zmean | Mean of z-scores | - | 0 | 4 out zsd | Standard deviation of z-scores | - | 1 | 4
Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work
Method: the standard formula for this calculation with the constants and conversion factors written on the page, rounded as each result states. See method and constants, the disclaimer or report an error.
More in this section
- Normality to g/L Converter & Formula29.220 g/L
- Normality to meq/mL Conversion Calculator1.0000 meq/mL
- Normality Test Q-Q Plot: How to Read It
- Normality Test Results: How to Analyze Them
- Normality Slay the Spire?
- Normality Test for Paired t Test: How to Check