Math & Geometry
P-value Calculator (Z, t and Chi-square)
Turn a test statistic into a p-value. Choose a z test, a Student t test or a chi-square test, enter the statistic and, where needed, the degrees of freedom and the direction of the test. The calculator returns the p-value and tells you whether the result is significant at the 0.05 and 0.01 levels.
How to use this calculator
- Choose the distribution of your statistic: Z, Student t or chi-square.
- Enter the value of the statistic from your test.
- For t and chi-square, enter the degrees of freedom.
- For z and t, choose two-tailed, right-tailed or left-tailed to match your alternative hypothesis.
- Read the p-value and the decision at the 0.05 and 0.01 levels.
What a p-value means
A p-value is the probability of obtaining a test statistic at least as extreme as the one observed, assuming the null hypothesis is true. A small p-value means the data would be surprising if there were really no effect, which is taken as evidence against the null hypothesis. It is not the probability that the null hypothesis is true, and it does not measure the size or importance of an effect.
By convention a result is called statistically significant when p is below a level chosen in advance, most often 0.05 or 0.01. The American Statistical Association's 2016 statement on p-values warns that scientific conclusions should not rest on whether a p-value passes a single threshold, and recommends reporting effect sizes and confidence intervals as well.
Choosing the right test and tails
Use the z distribution when the statistic is standard normal, for example a test on a mean with known population standard deviation or a large-sample test of a proportion. Use the t distribution for means when the standard deviation is estimated from the sample; its degrees of freedom are usually n − 1 for one sample. Use chi-square for goodness-of-fit and independence tests, where degrees of freedom are the number of categories minus one, or (rows − 1) × (columns − 1) for a contingency table. A two-tailed test looks for a difference in either direction; a one-tailed test looks in one direction only and should be chosen before seeing the data. Chi-square tests are always right-tailed.
How the calculator computes p
The calculator does not use printed tables, so it works for any statistic and any number of degrees of freedom. The normal tail is obtained from the incomplete gamma function, the t tail from the regularised incomplete beta function I(ν ÷ 2, 1 ÷ 2, ν ÷ (ν + t²)), and the chi-square tail from the upper incomplete gamma function. These are the standard definitions of the distributions and give results accurate to many decimal places; very small p-values are shown in scientific notation. As degrees of freedom grow, the t distribution approaches the normal: with 10 degrees of freedom the two-tailed 5% critical value is 2.228, against 1.96 for z.
Formula & method
Z: p = 2 × (1 − Φ(|z|)) two-tailed, Φ = standard normal CDFt: p from the Student t distribution with ν degrees of freedom (regularised incomplete beta)χ²: p = P(X ≥ χ²) = Q(k ÷ 2, χ² ÷ 2) (regularised incomplete gamma)Z: two-tailed p = 2 × (1 − Φ(|z|)), where Φ is the standard normal cumulative distribution. t: p comes from the Student t distribution with ν degrees of freedom, computed with the regularised incomplete beta function. Chi-square: p = P(X ≥ χ²), computed with the regularised incomplete gamma function Q(k ÷ 2, χ² ÷ 2).
Worked example
Three classic critical values
- z = 1.96, two-tailed → p = 0.0500
- t = 2.0 with 10 degrees of freedom, two-tailed → p = 0.0734
- χ² = 11.07 with 5 degrees of freedom → p = 0.0500
Answer: The z and chi-square results are exactly at the 5% level; the t result is not significant at 0.05.
Frequently asked questions
What is a good p-value?
There is no good or bad p-value. Below 0.05 is conventionally called significant, but the threshold should be chosen in advance and the effect size reported too.
One-tailed or two-tailed?
Use two-tailed unless you decided before collecting data that only one direction matters. A one-tailed p-value is half the two-tailed value when the effect is in the predicted direction.
How do I find the degrees of freedom?
For a one-sample t test, n − 1; for a chi-square goodness-of-fit test, the number of categories minus 1; for a contingency table, (rows − 1) × (columns − 1).
Does p = 0.03 mean a 3% chance the null is true?
No. It means that if the null hypothesis were true, a result this extreme would occur about 3% of the time.
Why is the chi-square test only right-tailed?
The statistic sums squared differences, so larger values mean a worse fit; only the upper tail is evidence against the null hypothesis.
What is the critical value for 95% confidence?
1.96 for a two-tailed z test. For t it is larger and depends on the degrees of freedom, e.g. 2.228 with 10.