Skip to content

P-Value Calculator

Enter a z, t, chi-square, or F test statistic to calculate its one- or two-tailed p-value, inspect the CDF step, and compare the result with α = 0.05 and α = 0.01.

Free statistical calculator

Calculate a p-value from a test statistic

Choose a distribution, enter the statistic and degrees of freedom, then compare the result with α = 0.05 and α = 0.01.

Test distribution
Tail choice

For z and t, a one-tailed result follows the observed sign. Chi-square and F use the upper tail; their two-tailed option doubles the smaller tail.

P-value

0.049996

At α = 0.05Significant
At α = 0.01Not significant

Calculation steps

  1. Distribution: Standard normal (z) distribution; No degrees of freedom.
  2. Cumulative probability: CDF = 0.975002 and 1 − CDF = 0.024998.
  3. Tail conversion: p = 2 × min(CDF, 1 − CDF), giving p = 0.049996.

Quick reference: which distribution and tail should you use?

Test statisticExtra inputCommon tail choiceTypical question
zNoneOne or twoIs a normally standardized result unusually large in one direction or either direction?
tDegrees of freedomOne or twoIs a sample mean or mean difference unusually far from the null value?
Chi-squareDegrees of freedomUsually upperIs a goodness-of-fit, independence, or variance statistic unusually large?
FNumerator and denominator degrees of freedomUsually upperIs a variance ratio or model comparison statistic unusually large?

Choose the hypothesis and tail direction before looking at the observed result. For positive-only chi-square and F distributions, the calculator's two-tailed mode uses 2 × min(CDF, 1 − CDF); many standard chi-square and F procedures instead define an upper-tail p-value.

What is a p-value, and what problem does it solve?

A p-value is the probability, assuming the null hypothesis and its statistical model are true, of obtaining a test statistic at least as extreme as the observed one.

It turns a statistic such as z = 1.96 or t = 2.23 into a common probability scale. That lets you compare the observed result with a preselected significance level. It does not tell you the probability that the null hypothesis is true, the size of an effect, or whether the study design was sound.

If you need the surrounding hypothesis-test workflow, start with T-tests and p-values in Python. For the broader foundation—distributions, variance, confidence intervals, and hypothesis tests—see Statistics and Probability in Data Science.

How the calculator derives the result

The calculator first evaluates the cumulative distribution function, CDF(x) = P(X ≤ x), for the selected null distribution. It then converts that cumulative probability into the requested tail area.

  1. Select the null distribution. A z statistic uses the standard normal distribution; t, chi-square, and F also need degrees of freedom.
  2. Evaluate the CDF. The calculator uses an error-function approximation for z, regularized incomplete beta for t and F, and regularized incomplete gamma for chi-square.
  3. Convert the CDF to a tail probability. An upper-tail result is 1 − CDF. A symmetric two-tailed z or t result is 2 × min(CDF, 1 − CDF).
  4. Compare p with α. A result is statistically significant at a chosen threshold when p < α; this decision still needs effect size, uncertainty, and study context.

Worked example: z = 1.96, two-tailed

For z = 1.96, the standard normal CDF is approximately 0.975002. The upper tail is therefore 1 − 0.975002 = 0.024998. Doubling the smaller tail gives p ≈ 0.049996, which is below 0.05 but above 0.01.

Common interpretation traps

  • p < 0.05 is not a 95% probability that the alternative hypothesis is true.
  • A small p-value does not measure practical importance; report an effect size and confidence interval when possible.
  • Switching from two tails to one after seeing the sign of the statistic inflates false-positive risk.
  • Very large samples can produce small p-values for effects too small to matter.
  • A reported p = 0.000 is rounded output, not a probability that is exactly zero.

For notebook setup help, see JupyterLab vs. Jupyter Notebook or how to start JupyterLab.

The same p-value computation in Python

SciPy's survival functions (sf) calculate 1 − CDF directly and are usually more stable in a very small upper tail. These snippets reproduce the calculator's common cases.

Z statistic

from scipy import stats
 
z = 1.96
p_one_tailed = stats.norm.sf(abs(z))
p_two_tailed = 2 * stats.norm.sf(abs(z))
print(p_one_tailed, p_two_tailed)

T statistic

from scipy import stats
 
t_stat = 2.228
df = 10
p_one_tailed = stats.t.sf(abs(t_stat), df)
p_two_tailed = 2 * stats.t.sf(abs(t_stat), df)
print(p_one_tailed, p_two_tailed)

Chi-square statistic

from scipy import stats
 
chi_square = 3.841
df = 1
p_upper_tail = stats.chi2.sf(chi_square, df)
print(p_upper_tail)

F statistic

from scipy import stats
 
f_stat = 3.326
df1, df2 = 5, 10
p_upper_tail = stats.f.sf(f_stat, df1, df2)
print(p_upper_tail)

If you want to check the browser result inside your existing Jupyter workflow, RunCell (opens in a new tab) can run the SciPy cell in notebook context without changing the formulas above.

FAQ

How do I calculate a p-value from a test statistic?

Select the distribution matching the test statistic, provide its degrees of freedom when required, and choose the tail defined by the alternative hypothesis. The p-value is the corresponding tail area under the null distribution.

Is p less than 0.05 always statistically significant?

It is significant at α = 0.05 if that threshold was chosen in advance and the test assumptions hold. It is not automatically important in practice, and multiple testing may require a stricter threshold.

What is the difference between one-tailed and two-tailed p-values?

A one-tailed test looks for an effect in one prespecified direction. A two-tailed test allows extreme results in either direction and, for symmetric z and t distributions, doubles the smaller tail probability.

Why does a t test need degrees of freedom?

Degrees of freedom determine the thickness of the t distribution's tails. With more degrees of freedom, the t distribution approaches the standard normal distribution.

Can I calculate a p-value without raw data?

Yes, if you already have a valid test statistic and all required degrees of freedom. The calculator converts those summary values to a tail probability; it does not verify how the statistic was produced.

Related Guides