Kolmogorov-Smirnov Test Calculator

Enter your sample data as comma-separated values, choose a theoretical distribution (Normal or Exponential), and set your significance level (α). The Kolmogorov-Smirnov Test Calculator computes the D-statistic (maximum absolute difference between your empirical and theoretical CDF), the p-value, and a pass/fail conclusion on whether your data fits the chosen distribution.

Enter numeric values separated by commas, spaces, or line breaks. Non-numeric and empty cells are ignored.

Select the distribution you want to test your data against.

Common values: 0.05 (5%) or 0.01 (1%). Reject H₀ when p-value < α.

Only used when 'No' is selected above.

For Normal: standard deviation. For Exponential: rate λ (mean = 1/λ).

Results

KS Test Statistic (D)

--

P-Value

--

Conclusion

--

Sample Size (n)

--

Sample Mean

--

Sample Std Dev

--

Critical Value (D_crit)

--

Empirical vs Theoretical CDF

Results Table

Frequently Asked Questions

What is the Kolmogorov-Smirnov test used for?

The Kolmogorov-Smirnov (K-S) test is a non-parametric test that checks whether a sample comes from a specific theoretical distribution (e.g., Normal or Exponential). It works by measuring the maximum absolute difference (D-statistic) between the empirical cumulative distribution function (ECDF) of your data and the CDF of the theoretical distribution. A small D value (and large p-value) suggests your data fits the distribution well.

What does the D-statistic represent?

The D-statistic is the maximum vertical distance between the empirical CDF of your sample and the theoretical CDF at any point. Larger D values indicate greater deviation from the hypothesized distribution. If D exceeds the critical value at your chosen significance level, you reject the null hypothesis that the data follows the specified distribution.

How do I interpret the p-value from a KS test?

If the p-value is greater than your significance level α (typically 0.05), you fail to reject the null hypothesis — meaning the data is consistent with the specified distribution. If p < α, you reject the null hypothesis and conclude the data does not follow that distribution. Note that 'failing to reject' is not the same as proving normality.

What is the difference between the KS test and the Lilliefors test?

The standard KS test requires you to specify the distribution parameters (mean and standard deviation) in advance. When you estimate these parameters from the sample data itself, the standard KS critical values are too lenient, so the Lilliefors correction applies more appropriate critical values. This calculator offers both modes — select 'Yes' for use-sample-parameters to apply the Lilliefors approach.

When should I use the KS test versus the Shapiro-Wilk test?

The Shapiro-Wilk test is generally more powerful for testing normality, especially for small to moderate sample sizes (n < 50), and is preferred when data has no repeated values. The KS test is more flexible because it can be applied to any theoretical distribution (not just Normal), and it works reasonably well for larger samples. Use KS when you need to test against Exponential, Uniform, or other distributions.

What sample size is recommended for the KS test?

The KS test can be applied to any sample size, but it has the most statistical power for moderate to large samples (n ≥ 30). For very small samples (n < 10), the test has low power and may miss real deviations from normality. For very large samples, even trivial departures from normality can yield significant results, so always complement the test with visual tools like Q-Q plots.

What is the null hypothesis of the KS test?

The null hypothesis (H₀) states that the sample data comes from the specified theoretical distribution (e.g., a Normal distribution with given mean and standard deviation). The alternative hypothesis (H₁) states that the data does not follow that distribution. You reject H₀ when the p-value falls below your chosen significance level α.

Can the KS test be used for distributions other than Normal?

Yes. The KS test is distribution-free in the sense that it can be applied to any continuous theoretical distribution — including Exponential, Uniform, Weibull, Log-Normal, and Logistic distributions. This calculator supports Normal and Exponential distributions. You simply supply the appropriate parameters (or estimate them from data) for the distribution you are testing against.

More Statistics Tools