Try it on your own data
Every report in this article is in the free plan. One snippet for web and apps, up to 10 sites.
Start freeTo calculate a p-value by hand, state the null hypothesis, compute the test statistic (z, t or chi-square), find the tail area beyond it in a printed table and double it for a two-sided z or t test. Below, that one procedure runs on a conversion-rate z-test, a 15-day t-test and a 2×2 chi-square, with each table lookup shown and checked against software.
What you will learn
- Every test uses the same four steps: H0 and direction, test statistic, tail area from a table, adjustment for direction
- A z table gives the area almost exactly; t and chi-square tables only bracket p between two columns, such as 0.01 to 0.02
- Double the tail for two-sided z and t tests, never for a 2×2 chi-square, and check the result against an exact value
What do you need before you calculate a p-value by hand?
A p-value is the probability, assuming the null hypothesis is true, of getting a test statistic at least as extreme as the one you observed. To compute it by hand you need four things written down before any arithmetic:
- The null hypothesis (H0). Usually "no difference": both page versions convert at the same rate, or the daily rate equals its long-run value.
- The alternative and its direction. Two-sided ("the rates differ") or one-sided ("the new version is higher"). Decide this before looking at the data; it changes the final step.
- The test statistic and its distribution. Proportions with large samples use z and the standard normal distribution. A mean from a small sample uses t. Counts in a table use chi-square.
- The degrees of freedom, for t and chi-square. A one-sample t-test has n − 1. A chi-square test on a table with r rows and c columns has (r − 1) × (c − 1), so a 2×2 table has 1.
You also need a printed or online table for each distribution. This guide uses the tables in the NIST/SEMATECH e-Handbook of Statistical Methods, a U.S. government reference, because they are free and stable. Watch their layout: the NIST normal table gives the area between 0 and z, not the area to the left of z, so you add or subtract 0.5 yourself.
What a p-value does and does not tell you is covered in how to interpret a p-value. This guide is about getting the number.
| Test | Use it for | Statistic | Degrees of freedom | Table to read |
|---|---|---|---|---|
| Two-proportion z-test | Two conversion rates with large samples | z = (p₂ − p₁) ÷ √[p(1 − p)(1/n₁ + 1/n₂)] | None | Standard normal |
| One-sample t-test | A small-sample mean against a fixed value | t = (mean − μ₀) ÷ (s ÷ √n) | n − 1 | Student's t |
| Chi-square test of independence | Counts in a table, such as device × completed | χ² = Σ (O − E)² ÷ E | (rows − 1) × (columns − 1) | Chi-square, upper tail |
| Chi-square goodness of fit | Observed split against an expected split | χ² = Σ (O − E)² ÷ E | categories − 1 | Chi-square, upper tail |
For a 2×2 table, the chi-square test of independence and the two-proportion z-test give the same p-value, because χ² = z².
What is the general procedure?
Every by-hand p-value follows the same four steps:
- State H0 and the direction of the test.
- Compute the test statistic from your data: z, t or χ².
- Find the tail area beyond that statistic in the table for its distribution. For z you can read the area almost exactly. For t and χ², a table lists only a few critical values per row, so you bracket the statistic between two columns and report a range, such as 0.01 < p < 0.02.
- Adjust for direction. For z and t, the table gives one tail; double it for a two-sided test. For chi-square, the upper tail already is the two-sided answer for a 2×2 comparison, so do not double it.
The rest of this guide runs that procedure on the three tests people use most with website and product data, then checks each answer against software.
Example 1: how do you get a p-value from a two-proportion z-test?
Sample data: a checkout page is shown in two versions to 5,000 visitors each. Version A converts 200 visitors (4.0%), version B converts 230 (4.6%). Is the 0.6-point difference more than chance?
Step 1. H0: both versions have the same conversion rate. Two-sided test, because a drop would matter as much as a rise.
Step 2. Compute z with the pooled rate:
- Pooled rate p = (200 + 230) ÷ (5,000 + 5,000) = 430 ÷ 10,000 = 0.043
- Standard error = √[p × (1 − p) × (1 ÷ 5,000 + 1 ÷ 5,000)] = √(0.043 × 0.957 × 0.0004) = √0.0000164604 = 0.004057
- z = (0.046 − 0.040) ÷ 0.004057 = 1.479, which rounds to 1.48 for the table
Step 3. In the NIST standard normal table, go to the row 1.4 and the column 0.08. The entry is 0.43056: the area between 0 and 1.48. The area beyond 1.48 is 0.5 − 0.43056 = 0.06944.
Step 4. Two-sided, so double it: 2 × 0.06944 = 0.139.
A p-value of 0.139 means that if the versions really converted at the same rate, a gap at least this large would turn up in about 14% of tests this size. At the usual 0.05 threshold, you would not call B better. The data are also compatible with no difference, which is not the same as proving there is none. How large a sample this comparison would need is the subject of statistical significance.
Example 2: how do you bracket a p-value from a t-table?
Sample data: after a checkout change, a store records its daily conversion rate (%) for 15 days. Over the previous year the daily rate averaged 3.0%. Is the new level different?
3.1, 3.6, 2.9, 3.4, 3.8, 3.0, 3.3, 4.1, 2.8, 3.5, 3.2, 3.9, 3.0, 3.6, 2.6
Step 1. H0: the true mean daily rate is still 3.0%. Two-sided.
Step 2. Compute t:
- n = 15, sum = 49.8, mean = 49.8 ÷ 15 = 3.32
- Sum of squared deviations from 3.32 = 2.604, so the sample standard deviation s = √(2.604 ÷ 14) = √0.186 = 0.4313
- Standard error = s ÷ √n = 0.4313 ÷ 3.873 = 0.1114
- t = (3.32 − 3.00) ÷ 0.1114 = 2.874, with df = 15 − 1 = 14
Step 3. In the NIST t table, the row for 14 degrees of freedom reads:
| Probability less than the value | 0.90 | 0.95 | 0.975 | 0.99 | 0.995 | 0.999 |
|---|---|---|---|---|---|---|
| Critical t, df = 14 | 1.345 | 1.761 | 2.145 | 2.624 | 2.977 | 3.787 |
2.874 sits between 2.624 (the 0.99 column) and 2.977 (the 0.995 column). So the area above t is between 1 − 0.995 = 0.005 and 1 − 0.99 = 0.01.
Step 4. Double for a two-sided test: 0.01 < p < 0.02.
That range is enough for most decisions: it is below 0.05, so the 15-day level is unlikely under H0. Treating days as independent is an assumption; a weekly pattern or a one-off campaign day can break it, so look at the series before trusting the test.
Example 3: how do you get a p-value from a 2×2 chi-square test?
Sample data: of the sessions that started checkout, 540 of 1,200 desktop sessions completed (45.0%) and 600 of 1,500 mobile sessions did (40.0%). Is completion related to device?
Step 1. H0: completion and device are independent. With df = 1 the chi-square test is two-sided by construction.
Step 2. Compute expected counts as row total × column total ÷ grand total (2,700 sessions, 1,140 completed, 1,560 not), then sum (observed − expected)² ÷ expected:
| Cell | Observed | Expected | (O − E)² ÷ E |
|---|---|---|---|
| Desktop, completed | 540 | 1,200 × 1,140 ÷ 2,700 = 506.67 | 2.193 |
| Desktop, not completed | 660 | 693.33 | 1.603 |
| Mobile, completed | 600 | 633.33 | 1.754 |
| Mobile, not completed | 900 | 866.67 | 1.282 |
| Total | 2,700 | 2,700 | χ² = 6.832 |
df = (2 − 1) × (2 − 1) = 1.
Step 3. In the NIST upper-tail chi-square table, the row for 1 degree of freedom has 3.841 (0.95), 5.024 (0.975), 6.635 (0.99) and 10.828 (0.999). 6.832 lies between 6.635 and 10.828, so the upper-tail area is between 0.001 and 0.01.
Step 4. No doubling: 0.001 < p < 0.01.
A shortcut check: for a 2×2 table, χ² equals the square of the two-proportion z statistic for the same data. √6.832 = 2.614, and running Example 1's z-test on these counts gives the same 2.614, so the two methods agree. Some textbooks apply Yates' continuity correction to 2×2 tables, subtracting 0.5 from each |O − E| before squaring; here that gives χ² = 6.629 and p ≈ 0.0100. State which version you used.
How do you check a hand calculation against software?
Compare each hand answer with an exact value. A table bracket should contain the exact p-value, and a z lookup should match to about two significant figures:
| Example | Statistic | Hand result from the NIST table | Exact p-value | Agree? |
|---|---|---|---|---|
| Two-proportion z-test | z = 1.479 | 0.139 (z rounded to 1.48) | 0.1392 | Yes |
| One-sample t-test, df = 14 | t = 2.874 | 0.01 to 0.02 | 0.0123 | Yes, inside the bracket |
| Chi-square 2×2, df = 1 | χ² = 6.832 | 0.001 to 0.01 | 0.0090 | Yes, inside the bracket |
Ways to get the exact value without a dedicated tool:
- Normal: p (two-sided) = 2 × (1 − Φ(|z|)). Python's standard library has it:
2 * (1 - NormalDist().cdf(1.4789))from thestatisticsmodule returns 0.1392. - Chi-square with 1 df: p = erfc(√(χ² ÷ 2)), which
math.erfccomputes:erfc(sqrt(6.832 / 2))returns 0.0090. - t: needs the t distribution's survival function from a statistics library, or a spreadsheet's t-distribution function, with 14 degrees of freedom and two tails.
If your hand answer falls outside the bracket, the usual causes are a wrong df, reading a cumulative table as a tail table, or forgetting to double.
Exact p-value of each worked example
two-sided pWhat mistakes are common when calculating p-values by hand?
- Mixing table types. Some normal tables give the area left of z (0.93056 for 1.48), others the area from 0 to z (0.43056). Both lead to 0.06944 for the upper tail, but only if you know which one you are holding.
- Doubling the wrong thing. Double the one-tail area for two-sided z and t tests; never double a chi-square upper tail for a 2×2 test, and never double a one-sided test.
- Choosing the direction after seeing the data. Switching to one-sided because B came out higher halves the p-value without any new evidence.
- Rounding too early. Round z only when you enter the table. Rounding the standard error to 0.004 in Example 1 gives z = 1.50 and p = 0.134 instead of 0.139.
- Using z for a small sample mean. With 15 observations the t distribution has fatter tails. z = 2.874 would give p ≈ 0.004, about three times smaller than the correct t result of 0.0123.
- Peeking repeatedly. Calculating a p-value every day and stopping at the first value below 0.05 makes false positives far more likely than 5%. Fix the sample size in advance.
- Treating p as the probability that H0 is true. The American Statistical Association's 2016 statement lists this among its six principles: a p-value does not measure the probability that the hypothesis is true, or the size of an effect.
How do you get the inputs for these tests from TapCub?
TapCub does not run A/B tests, split traffic or compute p-values; it supplies the counts that go into the formulas above. The three examples map onto it like this:
- Conversion counts for a z-test. In Web analytics › Goals, each goal shows conversions, distinct converters and a conversion rate whose denominator is distinct visitors in the date range. Filter to each version's page, or to the traffic you are comparing, and use distinct converters and distinct visitors as x and n. Recognized bots and AI crawlers are reported separately under Web analytics › Bots and kept out of human visitors, so automated traffic does not enlarge n.
- Daily values for a t-test. Web analytics › Reports lists one row per day; its conversion rate divides conversion count by sessions. Copy the 15 daily rates after the change into a sheet and run Example 2's steps. Mark the change date in Configuration › Annotations so everyone reading the chart sees where the "after" period starts.
- A 2×2 table for chi-square. In All-platform analytics › Behavior › Behavior analysis, build a funnel from checkout started to purchase and break it down by device type. The funnel counts sessions or people that entered step one and those that converted, which gives the four cells of Example 3 (converted and not converted for each device). A funnel breakdown keeps the 10 groups with the most entries.
- Decide outside TapCub. Run the calculation by hand or in a sheet, record the p-value with the date range and the counts, and note which goal or funnel definition produced them so the result can be reproduced.
FAQ
How do you calculate a p-value by hand?
State the null hypothesis and whether the test is one- or two-sided, compute the test statistic (z, t or χ²), look up the tail area beyond it in a table for that distribution, and double it for a two-sided z or t test. In the z example here, z = 1.48 gives a one-tail area of 0.06944 and a two-sided p-value of 0.139.
How do you find a p-value from a t-table?
Find the row for your degrees of freedom, then locate the two critical values your t statistic falls between. The column headings give the tail areas, so the p-value lies between them. With df = 14 and t = 2.874, the statistic falls between 2.624 and 2.977, so one tail is 0.005–0.01 and the two-sided p-value is 0.01–0.02.
Can you calculate an exact p-value without a table?
For z and for chi-square with one degree of freedom, yes, with the error function: two-sided p = erfc(|z| ÷ √2), and for chi-square p = erfc(√(χ² ÷ 2)). Most languages include erfc in their standard math library. The t distribution has no such simple form, so you use a table bracket or a statistics library.
Do you double the p-value for a chi-square test?
No. The chi-square statistic squares the differences, so its upper tail already covers deviations in both directions. For a 2×2 table, the upper-tail area is the same as the two-sided p-value from the equivalent z-test. In Example 3, χ² = 6.832 and z = 2.614 both give p ≈ 0.009.
Why does my hand calculation differ slightly from software?
Mostly rounding: tables round the statistic to two decimals and list areas to four or five digits, so z = 1.479 becomes 1.48 and p comes out 0.139 instead of 0.1392. If the gap is larger, check the degrees of freedom, whether a continuity correction was applied, and whether the software ran a one-sided test.
Sources
- NIST/SEMATECH. Cumulative distribution function of the standard normal distribution, e-Handbook of Statistical Methods, section 1.3.6.7.1 — area from 0 to z; 0.43056 at z = 1.48. Checked 2026-11-28.
- NIST/SEMATECH. Critical values of the Student's t distribution, section 1.3.6.7.2 — df = 14 row: 2.145, 2.624, 2.977. Checked 2026-11-28.
- NIST/SEMATECH. Critical values of the chi-square distribution, section 1.3.6.7.4 — df = 1 row: 3.841, 6.635, 10.828. Checked 2026-11-28.
- Ronald L. Wasserstein & Nicole A. Lazar. The ASA Statement on p-Values: Context, Process, and Purpose, The American Statistician, 2016 — six principles on what p-values do and do not measure. Checked 2026-11-28.
Was this article helpful?
We use your answers to fix and expand this page.
Couldn’t send. Please try again in a minute.
Thanks for the feedback. We’ll use it to improve this page.You’ve already sent feedback on this page. Thanks.

Customer Experience Consultant
Writes about live chat, visitor conversations, and self-service, sharing practical ways to make customer communication clearer and more effective.



