Percentages and Math

Kolmogorov-Smirnov Test Calculator

Paste a sample, choose a model or a second sample, and read the D statistic and the p value.

Your numbers

Test

Normal: the mean. Uniform: the low end. Exponential: the rate (1 / mean).

Normal: the standard deviation. Uniform: the high end. Not used for the exponential.

Numbers separated by commas, spaces or new lines. Example data.

Result

D statistic

0.244578

p = 0.5259 against normal(mean 5, SD 2) with 10 values.

D statistic
0.244578
p value (asymptotic)
0.5259
Sample size
10
Scaled statistic
0.811281
How this was calculated
  1. D is the largest vertical gap between the sample's step function and the model distribution function: the maximum over the sorted values of i/n - F(x) and F(x) - (i - 1)/n.
  2. D = 0.244578. The scaled statistic is (sqrt(n) + 0.12 + 0.11 / sqrt(n)) x D = 0.811281.
  3. The p value is the Kolmogorov distribution tail 2 x sum of (-1)^(k-1) exp(-2 k^2 lambda^2).
  • The model must be fully specified in advance. If you estimated its mean or spread from the same sample, the p value is too large and a Lilliefors-type correction is needed. For small samples the asymptotic p value is approximate.

Calculated using SumPanda.com · https://sumpanda.com/kolmogorov-smirnov-test-calculator/

Results are estimates for general information. Verify important figures before relying on them.

Next step

How to use the kolmogorov-smirnov test calculator

  1. Choose One sample vs a model or Two samples.
  2. For one sample, choose the model (normal, uniform or exponential) and enter its parameters. For two samples, enter both lists.
  3. Paste each sample as numbers separated by commas, spaces or new lines.
  4. Read the D statistic, which is the largest gap between the two cumulative curves, and the asymptotic p value.

Formula

D = the largest vertical distance between the empirical cumulative distribution and the model (or the other sample)

One sample scaled statistic: (sqrt(n) + 0.12 + 0.11 / sqrt(n)) x D

Two sample effective size: n x m / (n + m)

p value = 2 x sum over j of (-1)^(j-1) x exp(-2 j^2 x scaled statistic^2)

The series is the Kolmogorov distribution. The scaled statistic uses a small sample correction, so the p value is better than the bare asymptotic form at modest sample sizes. It remains an approximation.

Ten values against a normal model

The ten values 3.1, 4.2, 4.8, 5.5, 6.1, 6.7, 7.3, 8.0, 4.4 and 5.9 are compared with a normal distribution with mean 5 and standard deviation 2. The largest gap between the sample curve and the model is D = 0.244578. The scaled statistic is 0.811281 and the p value is 0.5259, so there is no evidence against the model.

For two completely separated samples, 1 to 5 and 6 to 10, the largest gap is D = 1 and the p value is 0.0037814 with an effective sample size of 2.5.

What the test checks

The test looks at the whole shape of a distribution, not just its mean or spread. A small p value says the sample and the model, or the two samples, are unlikely to come from the same distribution. A large p value only says that this test found no clear gap, which is weaker evidence when the sample is small.

If your question is only whether data are normal, the Shapiro-Wilk test is usually more powerful. To see how a sample departs from normal in shape, use the skew and kurtosis calculator.

Parameters from the same data

The one sample test assumes the model is fully specified before you look at the data. If you estimate the mean and standard deviation from the same sample, the p value is too large and the test is too forgiving. A Lilliefors style correction is needed for that case, and this page does not apply one.

For counts in categories, the chi-square calculator is the usual goodness of fit tool.

Assumptions and limits

  • Observations are independent and come from a continuous distribution. Many tied values weaken the test.
  • Model parameters are chosen in advance and not estimated from the same sample.
  • The p value is asymptotic with a small sample correction, so treat it as approximate for very small samples.
  • The exponential model uses the rate you enter, and the uniform model uses the low and high ends.

Formulas reviewed October 10, 2026. See the calculation methodology for how SumPanda rounds, tests and sources its formulas.

Frequently asked questions

What does the D statistic mean?

It is the biggest vertical distance between two cumulative curves, on a scale from 0 to 1. A value near 0 means the curves nearly coincide and a value near 1 means they are far apart.

Can I compare two samples without a model?

Yes. Choose Two samples and enter both lists. The test asks whether they could share one distribution.

Is it valid for small samples?

The p value is approximate for small samples. Use it as a guide, and for very small samples prefer a table of exact critical values.

How does it differ from a t test?

A t test compares means. This test is sensitive to any difference in the distribution, including spread and shape, but it is less powerful for a pure shift in the mean.