Skip to main content

How to find a p-value

There is no single p-value formula. There is one idea — the tail area of the distribution your statistic follows under the null hypothesis — and a short formula for each test that applies it. Here are all of them, worked through.

8 min read · Last reviewed 7 August 2026

Why there is no single p-value formula

A p-value is the probability, assuming the null hypothesis is true, of a test statistic at least as extreme as the one you observed. Geometrically it is an area: the part of a probability distribution that lies beyond your statistic.

Which distribution depends on which test you ran. A z-statistic follows the standard normal curve, a t-statistic follows Student's t, and so on. So the "formula" for a p-value is always the same instruction — find the tail area beyond your statistic — applied to a different curve. That is why a search for the p-value formula turns up five different answers, and why every one of them is right for its own test.

The p-value formula for each test

In each row, the capital letter is a random variable following the distribution in the middle column, and the lower-case letter is the statistic you calculated.

StatisticDistribution under H₀P-value
z Standard normal Two-tailed: 2 × P(Z ≥ |z|)
Right: P(Z ≥ z) · Left: P(Z ≤ z)
t Student's t (df) Two-tailed: 2 × P(T ≥ |t|)
χ² Chi-square (df) P(χ² ≥ x) — right tail only
F F (df₁, df₂) P(F ≥ f) — right tail only
r Student's t (df = n − 2) Convert first:
t = r√(n − 2) / √(1 − r²)
then as for t

Textbooks usually write the z case using Φ, the cumulative distribution function of the standard normal: p = 2[1 − Φ(|z|)] for a two-tailed test. That is the most common answer to "what is the p-value formula", and it is correct as mathematics. As a recipe for a computer it has a flaw, which the last section explains.

Chi-square and F have no two-tailed version. Both statistics are built from squared deviations, so a departure from the null in any direction makes them larger, and all the evidence lives in the upper tail. The guide to one- and two-tailed tests covers when the one-tailed versions of z and t are legitimate.

How to find a p-value in four steps

  1. Calculate the test statistic from your data — the z, t, χ², F or r your test produces. If you have raw data rather than a statistic, the test calculators do this step for you.
  2. Identify its distribution under the null hypothesis, and the degrees of freedom that pin it down. Every distribution here except the normal needs at least one. The degrees of freedom guide has the formula for every common test.
  3. Choose the tail — two-tailed unless you committed to a direction before seeing the data; always right-tailed for χ² and F.
  4. Find the area in that tail with software, a calculator, or a printed table. That area is the p-value.

Worked examples

Each example gives the value the matching converter on this site prints, so you can check your own working against it.

From a z-score

Suppose z = 2.17. The standard normal CDF gives Φ(2.17) = 0.9850, so the area above 2.17 is 0.0150. That is the one-tailed p-value. Doubling it for a two-tailed test gives p = 0.0300. For a negative z, use its absolute value — the normal curve is symmetric, so z = −2.17 gives the same two-tailed answer. The z-score to p-value converter does this directly.

From a t-statistic

Suppose t = 2.31 with 27 degrees of freedom. The area above 2.31 under Student's t with df = 27 is 0.0144, so the two-tailed p = 0.0288. Notice this is larger than a z of the same size would give: the t-distribution's heavier tails account for the variance having been estimated. Use the t to p-value converter to reproduce it.

From a chi-square statistic

Suppose χ² = 9.14 with 3 degrees of freedom, from a 2 × 4 contingency table. The area above 9.14 under a chi-square with df = 3 is p = 0.0275, and that is the whole answer — there is no doubling. The chi-square converter locks the tail for this reason.

From an F-statistic

Suppose a one-way ANOVA with three groups and 30 observations gives F = 4.07. The degrees of freedom are 2 between groups and 27 within, and the area above 4.07 under F(2, 27) is p = 0.0285. Order matters: F(27, 2) is a different distribution entirely. The F converter asks for both.

From a correlation coefficient

Suppose r = 0.42 from n = 30 pairs. Converting gives t = 0.42 × √28 / √(1 − 0.42²) = 2.449 with 28 degrees of freedom, and the two-tailed p = 0.0208. The correlation converter takes r and n and does the conversion internally.

How to find a p-value by hand, from a table

Without software you cannot get an exact p-value for t, χ² or F — only a range. A printed table lists critical values at a few fixed significance levels, and you find where your statistic falls between them.

Take the t example. Tables rarely have a row for df = 27, so use the next row down, which is the conservative choice. On the df = 25 row, the two-tailed critical values are 2.060 at α = 0.05 and 2.485 at α = 0.02. Your t = 2.31 sits between them, so 0.02 < p < 0.05. The exact value, 0.0288, is inside that range.

The chi-square example works the same way. On the df = 3 row the critical values are 7.815 at α = 0.05 and 9.348 at α = 0.025, and 9.14 falls between them: 0.025 < p < 0.05.

The z case is the exception, because a z-table lists areas rather than critical values, so you can read the tail directly and get a near-exact answer. The p-value tables on this site cover all five statistics, and are generated from the same engine as the calculators rather than copied from an older book. Journals now expect an exact p-value rather than a range, so treat the table as a check, not as the number you report.

How to find a p-value in software

Every package implements the same tail-area formula. For the t example above:

ToolTwo-tailed p for t = 2.31, df = 27
Excel=T.DIST.2T(2.31, 27)
R2 * pt(-abs(2.31), 27)
Python2 * stats.t.sf(2.31, 27)
TI-842 * tcdf(2.31, 1E99, 27)

Each has its own traps — argument order, which tail a function returns, how to type infinity. The step-by-step guides cover them for Excel, R, Python, SPSS and the TI-84.

The 1 − Φ trap, and why p is never 0.000

The textbook formula 1 − Φ(z) is correct on paper and fails in a computer. Once z is large, Φ(z) is so close to 1 that double-precision arithmetic rounds it to exactly 1, and 1 minus 1 is 0. At z = 9, 1 − Φ(9) evaluates to exactly zero, while the true tail area is 1.13 × 10⁻¹⁹.

This is where the p = 0.000 printed by many calculators comes from: when we entered z = 9 into thirteen online p-value calculators, eleven printed exactly zero. It is not a result: a p-value can be very small, but it cannot be zero. The fix is to compute the tail directly with a survival function — norm.sf in SciPy, lower.tail = FALSE in R — rather than subtracting from one. Every calculator on this site does that, and the methodology page publishes the comparison against SciPy that shows it.

Keep reading

Ready to run the numbers?

Our calculator shows the shaded distribution, the exact p-value, and a plain-English reading of what it supports.

Open the P-Value Calculator

Frequently asked questions

What is the formula for a p-value?

It depends on the test, because a p-value is the tail area of whichever distribution your statistic follows under the null hypothesis. For a z-statistic the two-tailed formula is p = 2 × P(Z ≥ |z|), usually written 2[1 − Φ(|z|)]. For t it is the same with Student's t in place of the normal, and for chi-square and F it is the right-tail area P(X ≥ x).

How do I find the p-value from a z-score?

Find the area beyond the z-score under the standard normal curve, and double it for a two-tailed test. For z = 2.17 the upper-tail area is 0.0150, so the two-tailed p-value is 0.0300. Use the absolute value of z if it is negative.

How do I find a p-value without a calculator?

Use a printed table. Find the row for your degrees of freedom and see which two critical values your statistic falls between; the p-value lies between their significance levels. For t = 2.31 with df = 25 the critical values are 2.060 at 0.05 and 2.485 at 0.02, so 0.02 < p < 0.05. Tables only give a range, so use software when you need the exact value.

Do I need degrees of freedom to find a p-value?

For every common test except z, yes. The t, chi-square and F distributions change shape with their degrees of freedom, so the same statistic gives a different p-value at a different df. Correlation needs the sample size n, from which df = n − 2.

Why does my calculator say p = 0.000?

Because it computed the tail as 1 minus the cumulative probability, and in floating-point arithmetic that rounds to zero once the statistic is large. The true p-value is tiny but never zero — at z = 9 it is 1.13 × 10⁻¹⁹. Report it as p < .001, and use a tool that computes the tail directly.