P-value calculator
Paste your data and run a one-sample or two-sample t-test, a z-test or a chi-square goodness-of-fit test. You get the test statistic, the degrees of freedom and the p-value, with the p-value drawn as the shaded tail of the null distribution.
How to use it
- 1Put your data in a list or a table column:
L = [5.1, 4.9, 5.6, 5.8]. - 2Type a test:
ttest(L, 5)compares the mean of L with 5;ttest2(A, B)compares two groups;ztest(L, 5, 0.4)uses a known standard deviation;chisqtest(O)orchisqtest(O, E)tests counts. - 3The statistic, degrees of freedom, p-value and a plain-language reading appear under the row, and the graph shades the p-value.
What a p-value is, and isn’t
A p-value is the probability of getting data at least as extreme as yours if the null hypothesis were true. A small p-value means your data would be surprising under the null hypothesis, which counts as evidence against it.
It is not the probability that the null hypothesis is true, and it doesn’t measure how big or important an effect is. A tiny effect can have a tiny p-value with enough data, and a large effect can miss significance with too little.
The 0.05 threshold is a convention, not a law of nature. Report the p-value itself, and the size of the effect with its uncertainty.
Which test?
| Question | Test | Type |
|---|---|---|
| Is the mean of one sample different from a value? | One-sample t-test | ttest(L, 5) |
| Do two groups have different means? | Two-sample t-test (Welch) | ttest2(A, B) |
| Same as the first, with the population σ known | z-test | ztest(L, 5, 0.4) |
| Do counts match expected proportions? | χ² goodness of fit | chisqtest(O, E) |
From a test statistic
If you already have a statistic, the p-value is a tail area of its distribution. Type these directly:
| Statistic | Two-sided p-value | Value |
|---|---|---|
| z = 2.1 | 2(1 - normalcdf(2.1)) | 0.0357 |
| t = 2.31, 11 df | 2(1 - tcdf(2.31, 11)) | 0.0413 |
| χ² = 7.8, 3 df (upper tail) | 1 - chisqcdf(7.8, 3) | 0.0503 |
One-sided and two-sided
The t and z tests here report two-sided p-values: evidence of a difference in either direction. If you decided in advance to test only one direction, and the data point that way, the one-sided p-value is half the two-sided one. The χ² test is always upper-tailed, because large values mean a poor fit.
Examples to try
A = [12, 14, 11, 15, 13, 14]B = [15, 17, 16, 18, 15, 19]ttest2(A, B)O = [8, 12, 9, 11, 6, 14]chisqtest(O)M = [5.3, 5.1, 5.6, 5.4, 5.2]ztest(M, 5, 0.3)Frequently asked questions
How do I calculate a p-value?
What does p < 0.05 mean?
Which t-test does ttest2 use?
Are the p-values one-sided or two-sided?
Related tools and guides
Probabilities, z-scores and percentiles, shaded on the bell curve.
Binomial probabilities shown as bars, with mean and SD.
Linear, polynomial, exponential or any custom model, with error bars.
Box and whisker plots, dot plots and histograms from a list.
Paste a column of data into a table, type a test next to it, and the p-value updates as you edit the numbers.