Coefficient of Variation Calculator
The coefficient of variation is one line of arithmetic, SD divided by the mean, times 100, and almost everything that goes wrong with it is hidden in that line. The same list has two answers: the sample standard deviation divides the squared distances from the mean by n - 1 and the population standard deviation divides by n, so 12, 15, 9, 14, 20 is a coefficient of variation of 29.01% on one basis and 25.95% on the other. This page names the basis it used in the readout, prints the other one underneath, and shows the formula with your own figures substituted into it. It takes either a list of values or a mean and a standard deviation you already have, reads up to 10,000 values from a spreadsheet column, and subtracts the mean before squaring so data that sits far from zero keeps its precision instead of collapsing the way the mean-of-squares shortcut does. Where the ratio has no value, at a mean of zero or below, it says undefined and why, rather than printing a number that reads like an answer.
- CV
- Mean
- SD (sample)
- Basis
Use the sample basis when these values are a sample drawn from something larger. Dividing by n - 1 rather than n corrects the tendency of a sample to look tighter than the population it came from, so the figure is slightly larger.
The sample standard deviation of 5 values is 4.0620 and the mean is 14, so the coefficient of variation is 29.01%. CV = 4.0620 / 14 x 100 = 29.01%
On the population basis, which divides by n, the same values give SD 3.6332 and CV 25.95%.
Commas, spaces, tabs, semicolons and new lines all separate values, so a column copied from a spreadsheet pastes straight in, and up to 10,000 values are read at a time. Figures are shown to four decimal places and percentages to two; the arithmetic itself keeps full double precision. Nothing you type leaves this browser.
Worked examples
The three cases a coefficient of variation usually starts from. Every figure here is computed by the same code as the answer above, so an example and the tool can never disagree.
Common questions
- How do I calculate the coefficient of variation?
- Divide the standard deviation by the mean and multiply by 100. For 12, 15, 9, 14, 20 the mean is 14 and the sample standard deviation is 4.0620, so the coefficient of variation is 29.01%. The page prints that substitution under the answer with your own figures in it, so a number typed into the wrong box is easy to spot, and it reports the result as a percentage because the ratio itself is unitless: the units of the spread and the units of the mean cancel.
- Should I use the sample or the population standard deviation?
- Use the sample basis when your values are a sample drawn from something larger, and the population basis when they are the whole group you care about. The difference is the divisor: n - 1 against n. It is not a rounding detail. The same five values, 12, 15, 9, 14, 20, give 29.01% on the sample basis and 25.95% on the population basis, because the sample standard deviation is 4.0620 and the population standard deviation is 3.6332. This page labels which one produced the figure and prints the other beside it, so the two are never confused.
- Can the coefficient of variation be negative or undefined?
- It has no value at all when the mean is zero, because there is nothing to divide by, and it is meaningless when the mean is negative, because the sign of the ratio then says something about the sign of the mean rather than about the spread. This page reports both as undefined and says which case it is, rather than printing a negative percentage or a division that looks like a figure. The mean and the standard deviation are still shown, since those remain perfectly well defined.
- Why is my coefficient of variation enormous?
- Because the mean is small next to the spread. The ratio has the mean on the bottom, so as the mean approaches zero the percentage grows without limit and a tiny change in the data moves it a long way. Above 100% the standard deviation is larger than the mean, and the page says so under the answer. The figure is still correct arithmetic on the numbers you gave; it is its usefulness as a comparison between datasets that has gone, not its accuracy.
- Can I use it on data that includes negative values?
- The arithmetic runs, and the page warns you. A coefficient of variation compares the spread with the mean on a ratio scale, where zero is a true zero: lengths, weights, counts, prices, durations. Temperature in Celsius, profit and loss, and anything else that crosses zero has an arbitrary origin, so the mean can be moved by changing the scale and the percentage moves with it. When any of your values is zero or negative and the mean is still above zero, the page computes the figure and states that caveat next to it.
- Do I need the raw data, or can I enter a mean and a standard deviation?
- Either. Switch the page to a mean and a standard deviation and it divides the two exactly as you give them, which is what you want when the figures come from a paper or an instrument report. A mean of 100 with a standard deviation of 15 is a coefficient of variation of 15.00%. In that mode the basis control is put away, since the divisor was decided by whoever worked out the standard deviation, and the readout says the basis is as given rather than claiming one.
- How many values can I paste, and how are they read?
- Up to 10,000 in one go. Commas, spaces, tabs, semicolons and new lines all separate values, so a column copied out of a spreadsheet pastes straight in, and currency symbols and accounting parentheses are read rather than refused. A comma always separates values, since 12,15,9 is the common case, so 1,234 is read as 1 and 234 and the page states that reading under the answer. Anything that is not a number comes back by name instead of being dropped quietly, and a figure larger than a double can hold is refused with the reason rather than returned as infinity.
- How accurate is the standard deviation on large numbers?
- The mean is subtracted before anything is squared, the squares are added with compensated summation, and the leftover drift in the mean is taken back out, which is why values far from zero keep their precision here. The textbook shortcut, the mean of the squares minus the square of the mean, loses every significant digit on such data and can return a negative variance: on 1000000004, 1000000007, 1000000013 and 1000000016 the shortcut goes negative while the centred route returns a sample variance of exactly 30.
- What is a good coefficient of variation?
- There is no universal threshold, and this page does not pretend there is one. What counts as high or low depends entirely on the field and on the measurement: a laboratory assay, a manufacturing tolerance and a portfolio of house prices all live in different ranges, and comparisons are only meaningful between measurements of the same kind on the same scale. The page computes the figure, names the basis and the limits, and leaves the judgement to whoever knows the data.
Exact arithmetic from centred sums, which keeps the variance stable when the data sit far from zero. The sample basis divides by n minus one and the population basis by n, and the page prints which one produced the number. A mean at or below zero makes the ratio meaningless, so it is reported as undefined rather than shown as a figure.