How to calculate the root mean square (RMS), with examples
The root mean square (RMS) answers a question the average cannot: when a quantity swings positive and negative, how big is it? The formula is one line — RMS = √(Σx² / n) — and the calculation is three steps you can do on paper in under a minute. This post walks through a full example, the two ways people get the wrong number, and when the answer is the same as the standard deviation.
The three steps
The name is the recipe, read backwards: root, mean, square. In order of operations that is:
- Square every value. Each one's sign disappears and its size becomes the thing that matters. A −3 and a +3 both contribute 9.
- Take the mean of the squares. Add the column of squares and divide by how many values you started with, n.
- Take the square root. This brings the number back to the units of the original data, so it can sit next to the original values and be compared with them.
A worked example, step by step
Five measurements, in volts: 5, −3, 2, −4, 4. Two of them are negative, so a
plain average would understate the size of what is going on.
| x | x² |
|---|---|
| 5 | 25 |
| −3 | 9 |
| 2 | 4 |
| −4 | 16 |
| 4 | 16 |
| Σ | 70 |
The sum of squares is 70. Divide by n = 5 for the mean of the squares: 70 ÷ 5 = 14. Take the root: RMS = √14 ≈ 3.7417 volts. Read it back in the data's own units: a typical value in this set is about 3.7 volts in size, whatever its sign.
Compare with the arithmetic mean. The values sum to 4, so the mean is 0.8 volts: the negatives have nearly cancelled the positives, which is exactly the situation the RMS exists for. The two numbers answer different questions — where the data is centred, and how big its values are — and that is why you report both.
Two ways to get it wrong
- Averaging first, then squaring. The square of the mean is not the mean of the squares: on this data, 0.8² = 0.64, against the mean of squares of 14. A factor of more than twenty off, from reversing two steps.
- Dividing by n − 1. The Bessel correction is for estimating a population's spread from a sample; the RMS has no such job. It describes the numbers in front of you, so it divides by n. Using n − 1 quietly inflates the result — by a factor of √(n/(n − 1)) — which is small when n is large and large when n is small.
When the RMS equals the standard deviation
Subtract the mean from the data first, and the population SD is just the RMS of the
remaining deviations: σ = √(Σ(x − x̄)² / n). On this example the deviations
from 0.8 are 4.2, −3.8, 1.2, −4.8 and 3.2. Squared, they are 17.64, 14.44, 1.44, 23.04
and 10.24, which sum to 66.8; the mean of those squares is 66.8 ÷ 5 = 13.36, so the
population SD is √13.36 ≈ 3.6551 — a touch below the RMS of 3.7417,
because centring the data on its own mean pulls the largest squared term down.
The identity that joins the two is RMS² = x̄² + σ², and it holds exactly on
this data: 0.8² + 13.36 = 0.64 + 13.36 = 14, the mean of the raw squares. When the mean
is exactly zero — a symmetrical waveform, the residuals of a fitted line, noise measured
about its baseline — there is nothing to subtract and the RMS is the standard
deviation, down to the last digit.
Check your answer
Paste the same five values into the root mean square calculator: it should return a mean of squares of 14 and an RMS of 3.7417, alongside the arithmetic mean of 0.8 and the standard deviation. The RMS versus standard deviation post covers when the two answers are the same number.
Related calculators
-
RMS calculator
Paste any list and get the RMS with the sum of squares, the mean and the SD alongside.
-
RMS vs SD
What the two share, when they are equal, and which to use where.
-
Sum of squares
Σx² and Σ(x − x̄)², the two totals this calculation starts from.
-
MSE calculator
RMS of the residuals: RMSE next to MAE and MAPE.
Common questions
What is the root mean square formula?
RMS = √(Σx² / n): square every value, add the squares, divide by the count,
take the square root. The name is the operations in reverse order — root last, mean in
the middle, squares first.
How do I calculate RMS by hand?
Write each value's square in a column, total the column, divide by how many values there are, then take the square root. On 5, −3, 2, −4, 4 the squares are 25, 9, 4, 16, 16; they total 70; 70 ÷ 5 = 14; and the RMS is √14 ≈ 3.7417.
Do I use n or n − 1 for RMS?
n. The RMS describes the numbers you have, not a population they came from, so there is no Bessel correction. The n − 1 divisor belongs to the sample standard deviation. If you also want the SD of the same data, the two differ only in that divisor: sample SD = √(Σ(x − x̄)² / (n − 1)).
Can RMS be negative?
No. Every value is squared before the root, and the square root is taken of an average of squares, which is never below zero. A single value's RMS is just its own absolute value.