
How to Find a P-Value: Formulas, Tables and a Worked Example

To find a p-value, you compute a test statistic from your data (z, t, F or chi-square), then ask how much of the null distribution lies at or beyond that statistic. That tail area is the p-value. You need three things: the statistic, the degrees of freedom where they apply, and the tail direction. In an A/B test, the p-value tells you how surprising your observed difference would be if the change did nothing. A testing tool like Stellar runs this calculation for you on every experiment, but knowing the mechanics lets you check any result you are shown.
TL;DR
- A p-value is the probability of seeing a result at least as extreme as yours if the null hypothesis is true. It is a tail area under a distribution curve.
- Inputs: the test statistic, the right distribution, degrees of freedom (for t, chi-square and F), and whether the test is left-, right- or two-tailed.
- Formulas: left-tailed is cdf(ts), right-tailed is 1 − cdf(ts), two-tailed is 2 × (1 − cdf(|ts|)) for a symmetric distribution.
- You can read it from a table (a range), or get an exact value from software such as R.
- A small p-value is not the probability that the null is true, and it does not measure how big or valuable the effect is.
Table of Contents
- What a p-value actually is
- What you need before you calculate
- The formulas
- Method 1: find a p-value with a table
- Method 2: find a p-value with software
- A worked example from an A/B test
- How to read the number you get
- Common mistakes when finding a p-value
- Where Stellar fits
- Our perspective
- FAQ
- Sources
What a p-value actually is
A p-value is the probability of getting a sample statistic as extreme as the one you observed, or more extreme, assuming the null hypothesis is true. OpenStax defines it as the area under the relevant probability curve, normal or t. The null hypothesis is the "nothing is going on" claim: the new headline does not change conversion, the two means are equal.
The smaller the p-value, the harder your data is to square with the null. Pernet's tutorial on significance testing describes the logic as proof by contradiction: you pose the null model and check whether the data conform to it. Fisher chose 0.05 as a rule of thumb because it sits roughly two standard deviations from the mean (1.96, close to 2) on a normal curve.
That 1.96 figure is worth memorizing. A z-score of 1.96 in a two-tailed test gives a p-value of about 0.05. Everything below is a more careful version of that idea.
What you need before you calculate
A test statistic on its own does not give you a p-value. You need to settle four inputs first.
- The test and its statistic. Comparing means with unknown population variance calls for a t-test. Comparing proportions, such as conversion rates, usually uses a z-test. Comparing several groups uses F. Testing counts across categories uses chi-square. Statistics By Jim walks through this choice: the data type and your goal decide which statistic you compute.
- The sampling distribution. This is the curve the statistic would follow if the null were true. The t, F and chi-square curves change shape with degrees of freedom.
- Degrees of freedom (df). Roughly, the number of independent pieces of information in your estimate. The Introduction to Statistics and Data Science textbook gives n − 1 for a single mean, about min(n1 − 1, n2 − 1) for a difference in two means, and n − k − 1 for regression coefficients.
- The tail. Your alternative hypothesis decides it. "The variant is different" is two-tailed. "The variant is better" is right-tailed. "The variant is worse" is left-tailed. If you want the marketing angle on this choice, our guide to one-tailed vs. two-tailed tests covers it.
Decide the tail before you look at the data. Switching to a one-tailed test after seeing the result halves your p-value without any new evidence behind it.
The formulas
Minitab's documentation states the manual formulas, where ts is your observed test statistic and cdf is the cumulative distribution function of the null distribution (the area to the left of a value):
| Test direction | P-value formula |
|---|---|
| Left-tailed | cdf(ts) |
| Right-tailed | 1 − cdf(ts) |
| Two-tailed (symmetric null distribution) | 2 × (1 − cdf(|ts|)) |
The statistic itself has a common shape: estimate minus null value, divided by the standard error. In the textbook's notation, t_stat = (Estimate − Null value) / SE(Estimate). For a single mean, Penn State writes it as t* = (x̄ − μ) / (s/√n), with n − 1 degrees of freedom.
For a correlation, Penn State's STAT 200 uses t = (r − ρ0) / √((1 − r²)/(n − 2)), with a t distribution on n − 2 degrees of freedom.
The p-value equation never changes. Only the statistic and the curve do.
Method 1: find a p-value with a table
Tables give a range, not an exact number. They are fine for a sanity check and for exams.
- State the hypotheses and pick your alpha (the cutoff, commonly 0.05).
- Compute the test statistic.
- Work out df.
- Open the table for your distribution and go to the row for your df.
- Find where your statistic falls between two critical values and read the matching tail probabilities from the column headers.
- Double a one-tailed probability if your test is two-tailed.
Worked example: you test a mean with n = 20, so df = 19, and get t = 1.49. In the df = 19 row of a t table, 1.49 falls between the critical values 1.328 (one-tail probability 0.10) and 1.729 (0.05). So the one-tailed p-value is between 0.05 and 0.10. Doubling gives a two-tailed p-value between 0.10 and 0.20, which is above 0.05 either way, so you do not reject the null.
For a z-test the logic is the same with the standard normal table, which has a mean of 0 and a standard deviation of 1. The table gives the cumulative area to the left of your z. For z = 1.96 that area is 0.975, so the right tail is 0.025 and the two-tailed p-value is 0.05.
Method 2: find a p-value with software
Software gives the exact value and removes lookup errors. In R, the textbook example uses a general two-sided formula that works whatever the sign of the statistic:
2 * pt(-abs(t_stat), df)
With t_stat = 2.91 and df = min(36 − 1, 32 − 1) = 31, that returns 0.007. Put plainly, if the true difference were zero, a gap this large would show up in about 0.7% of samples. The pt function is the t-distribution's cumulative function. For z-scores the equivalent is 2 * pnorm(-abs(z)). R's t.test function does the whole job, computing the statistic and the p-value from your raw data. Colorado State's PSY 652 notes point to the qt and pt functions as the tools behind the test numbers.
For F tests, Kaplan's guide computes the p-value in R as 1 − pf(F, df, n − df), and gives a handy shortcut: for samples of roughly 10 or more, an F of about 4 corresponds to p = 0.05.
Calculating a p-value from first principles is hard, as Kaplan notes. Practitioners lean on tables or a computer built on earlier statisticians' work. Do not feel you are cheating by using a function.
A worked example from an A/B test
Conversion rates are proportions, so a two-proportion z-test fits. Say you split traffic evenly:
- Control: 4,000 visitors, 200 conversions (5.0%)
- Variant: 4,000 visitors, 248 conversions (6.2%)
Step 1: hypotheses. Null: the two conversion rates are equal. Alternative: they differ (two-tailed).
Step 2: pooled rate. Total conversions 448 divided by total visitors 8,000 is 0.056.
Step 3: standard error. √(0.056 × 0.944 × (1/4,000 + 1/4,000)) ≈ 0.00514.
Step 4: z-statistic. Difference of 0.012 divided by 0.00514 gives z ≈ 2.33.
Step 5: p-value. Two-tailed: 2 × (1 − cdf(2.33)). The standard normal cdf at 2.33 is about 0.990, so p ≈ 2 × 0.0099, roughly 0.02.
Step 6: decision. 0.02 is below 0.05, so you reject the null at that threshold. Your data would be unusual if the two versions truly converted the same.
Two cautions apply to this result. First, a p-value of 0.02 does not mean there is a 98% chance the variant is better. Second, it says nothing about whether a 1.2-point lift is worth shipping. That is a business judgment about effect size.
If you would rather not do this by hand each time, our walkthrough on how to calculate p-value in A/B testing and the P test calculator cover the same arithmetic for experiment data. The seven inputs for calculating statistical significance is a good checklist before you trust any number.
How to read the number you get
The decision rule is simple. If p ≤ alpha, reject the null. Otherwise, do not reject it. Pernet's tutorial lists what the p-value is not:
- It is not the probability that the null hypothesis is true.
- It is not a measure of effect strength or magnitude.
- 1 − p is not the probability the result will replicate.
- A small p-value does not favor any one specific alternative over the others.
Colorado State's course notes add a point that matters for anyone running experiments: the same effect size gives different p-values at different sample sizes. That is why you report an effect size, such as the lift in percentage points, next to the p-value.
The p-value is also graded evidence, not a cliff. Pernet notes Fisher meant it to help decide whether a result deserved further investigation or replication, not to act as a binary gate. An open textbook makes the same point with p = 0.10: you can argue that a 10% chance is small enough to doubt the null, or that 10% of samples show such effects by chance. Both readings are reasonable. For the marketing version of this discussion, see interpreting statistical significance in A/B test results and our P-value explainer.
Common mistakes when finding a p-value
Using the wrong tail. A two-tailed test doubles the one-tailed tail area. Pick before you peek.
Wrong degrees of freedom. Reading the t table at df = n instead of n − 1 shifts your p-value. For two-sample comparisons, use the rule for your specific test.
Forgetting the absolute value. For a negative t, the formula 2 × (1 − cdf(|ts|)) uses the absolute value. The R form 2 * pt(-abs(t_stat), df) handles this automatically.
Reporting a table range as exact. If you read between two columns, write "0.05 < p < 0.10", not "p = 0.075".
Stopping a test the moment p dips below 0.05. The p-value assumes a sample size fixed in advance. Checking repeatedly and stopping on the first small value inflates false positives. Set your sample size before launch.
Testing many things at once. Each extra comparison gives chance another opening to produce a small p-value. Keep a tight list of hypotheses. If one of them is a call-to-action change, writing compelling CTAs gives you a stronger variant to test than a random tweak.

Where Stellar fits
Finding a p-value once is a statistics exercise. Finding one on every experiment, across every goal, is a workflow problem. Stellar is an A/B testing platform for marketers and growth teams. You build variants in a no-code visual editor, track goals, and watch results in real-time analytics dashboards, so the arithmetic above is not something you repeat in a spreadsheet for each test.
Stellar plans are tiered by monthly tracked users. Sandbox is $0 per month, Plus is $29 per month, Pro is $99 per month and Scale is $399 per month, with Enterprise available without a published price. Sandbox is the free tier for businesses under 25,000 monthly tracked users. See the plans on the Stellar homepage.

Our perspective
Most of the p-values we see marketers struggle with are not hard to compute. The hard part is knowing which question the number answers. A p-value tells you how compatible your data is with "no difference". It does not tell you the size of the win, and it does not tell you the variant is right.
That is why we build Stellar around the full picture: goals you define up front, real-time analytics, and a lightweight script designed to keep your pages fast while you test. We want you spending your time on which hypothesis to test next, not on re-deriving a z-score.
Learn the formula once. Then let your testing tool do the repetition, and keep your own judgment for effect size and business value.
Juan
FAQ
Can you find a p-value by hand?
Yes. Compute the test statistic, find the degrees of freedom, then look up the statistic in a z or t table. A table gives a range, such as between 0.05 and 0.10, while software gives the exact value. Doubling the one-tailed result gives the two-tailed p-value.
What is the formula for a p-value?
There is one formula per tail. Left-tailed is cdf(ts), right-tailed is 1 − cdf(ts), and two-tailed is 2 × (1 − cdf(|ts|)) when the null distribution is symmetric. The cdf is the cumulative distribution of the null curve, and ts is your test statistic.
How do you find a p-value from a t statistic?
Use the t distribution with the right degrees of freedom, n − 1 for a single mean. In R, 2 * pt(-abs(t_stat), df) returns the two-sided p-value. For t = 2.91 and df = 31 it gives 0.007.
What p-value counts as significant?
The common cutoff is 0.05, though some fields use 0.01 or 0.10. Fisher's 0.05 sits about two standard deviations from the mean on a normal curve. Choose your alpha before the test, and report the effect size alongside the p-value.
Sources
- 4.2 Hypothesis Testing, OpenStax Principles of Data Science
- Null hypothesis significance testing: a short tutorial
- How to Find the P value: Process and Calculations
- Chapter 11 P-values, Introduction to Statistics and Data Science
- Manually calculate a p-value, Minitab support
- S.3.2 Hypothesis Testing (P-Value Approach), Penn State STAT ONLINE
- 12: Correlation & Simple Linear Regression, Penn State STAT 200
- Conducting Common Hypothesis Tests, Colorado State PSY 652
- Chapter 10 So-called statistical significance, A Compact Guide to Classical Inference
Recommended
Published: 11/19/2026
