Uni-Sine
MathematicsStatistics

P-value calculator

A p-value calculator tells you how likely a result at least as extreme as yours would be if the null hypothesis were true. A small p-value, below your significance level such as 0.05, is evidence against the null hypothesis. Our Hypothesis Test Calculator runs z, t, chi-square and F tests from your data or summary values, and gives the test statistic, the p-value, the critical value and a conclusion in words.

It shades the p-value on the distribution, so you can see where your test statistic falls. It opens on a z test.

Try it

Hypothesis Test Calculator

Run z, t and chi-squared tests and read off the p-value

Go to its page

How to use the p-value calculator

  1. In Which test, choose the test: a z test for a mean, a one-sample, two-sample or paired t test, a chi-squared goodness of fit or independence test, or an F test for two variances.
  2. Choose the Alternative hypothesis: Two-tailed, Lower tail or Upper tail. Chi-squared tests always use the upper tail, so this option disappears for them.
  3. Choose the Significance level: 10%, 5%, 1% or 0.1%.
  4. In Values, type summary values, such as the sample mean, standard deviation and size, or switch to raw data and paste a column. Chi-squared tests take a table of counts.
  5. Read the test statistic, its degrees of freedom, the critical value, the p-value and the conclusion.

The conclusion is written out in full, for example: "The p-value (0.0169) is below the 5% significance level, so reject H₀. There is evidence at the 5% level that the mean is not 50." The working shows the hypotheses, the statistic and the comparison step by step.

What a p-value means

A p-value is the probability of getting a test statistic at least as extreme as the one you observed, assuming the null hypothesis H₀ is true. Compare it with the significance level α you chose before collecting the data:

  • p below α: reject H₀. The result would be unusual if H₀ were true.
  • p at or above α: do not reject H₀. There is not enough evidence against it.

A p-value is not the probability that H₀ is true, and a small p-value does not mean the effect is large or important. The American Statistical Association's statement on p-values makes both points.

Worked examples you can check in the calculator

Example 1: a z test, two-tailed and one-tailed

A population has standard deviation 15. A sample of 36 has mean 103. Test H₀: μ = 100 against H₁: μ ≠ 100 at the 5% level.

z = \frac{103 - 100}{15/\sqrt{36}} = \frac{3}{2.5} = 1.2

The two-tailed p-value is 0.2301, which is not below 0.05, so do not reject H₀. Change the alternative to Upper tail, for H₁: μ > 100, and the p-value halves to 0.1151: still not significant. Choose the z test, type 100 for the mean to test, 103, 15 and 36, and the calculator gives both.

Example 2: a one-sample t test

A sample of 20 has mean 52.4 and standard deviation 4.1. Test H₀: μ = 50 two-tailed at 5%. With σ unknown, use t with 19 degrees of freedom:

t = \frac{52.4 - 50}{4.1/\sqrt{20}} = 2.618

The p-value is 0.0169, below 0.05, so reject H₀: there is evidence the mean is not 50.

Chi square calculator: goodness of fit and independence

Example 3: is a dice fair?

A dice is rolled 60 times. The counts for 1 to 6 are 8, 12, 9, 11, 6 and 14. A fair dice would give 10 of each. Choose Chi-squared goodness of fit and type the observed counts, with 1 in the expected/ratio column for every face:

\chi^2 = \sum \frac{(O - E)^2}{E} = \frac{4 + 4 + 1 + 1 + 16 + 16}{10} = 4.2

With 6 − 1 = 5 degrees of freedom, the p-value is 0.5210, far above 0.05. There is no evidence the dice is unfair. The critical value at 5% is 11.07.

Example 4: a test of independence

100 people are asked which of three options they prefer, split by group:

Option AOption BOption CTotal
Group 118221050
Group 212132550
Total303535100

Each expected count is row total × column total ÷ grand total, such as 50 × 30 ÷ 100 = 15. Choose Chi-squared independence and type the six counts. The calculator gives χ² = 9.94 with 2 degrees of freedom and a p-value of 0.0069, so at the 5% level there is evidence that preference and group are associated. It also shows a table of observed and expected counts.

Check your reading of a p-value:

practice
Pick an answer, then check it.
A test at the 5% significance level gives a p-value of 0.031. What do you conclude?

P-value from a z, t or chi-square statistic

If you already have a test statistic rather than data, there are two routes.

  • From z or χ²: use the Probability Calculator. For z = 2.1 two-tailed, set Normal with mean 0 and standard deviation 1, shade P(X < a or X > b) with a = −2.1 and b = 2.1, and read 0.0357. For χ² = 9.49 with 4 degrees of freedom, choose Chi-Sq, shade P(X > a) with a = 9.49, and read 0.0500.
  • From t: the Hypothesis Test Calculator does not take a t statistic on its own, but you can make the summary values give it. Choose the one-sample t test, set the mean to test to 0, the sample size n to the degrees of freedom plus 1, the sample SD to √n, and the sample mean to your t. For t = 2.30 with 19 degrees of freedom, type n = 20, SD = 4.472136 and mean = 2.3: the two-tailed p-value is 0.0330.

Our probability calculator guide explains the distribution settings.

One-tailed or two-tailed?

Decide before you look at the data. Use a two-tailed test when H₁ says the value is different, in either direction. Use a one-tailed test when H₁ names a direction, greater than or less than. For the same statistic, a one-tailed p-value is half the two-tailed one when the result is in the direction you predicted.

Common mistakes

  • Saying "accept H₀". A large p-value means there is not enough evidence to reject H₀, not that H₀ is true.
  • Reading p as the chance H₀ is true. It is the chance of data this extreme if H₀ were true.
  • Choosing the tail after seeing the data. That halves the p-value unfairly. Decide first.
  • Using a z test when σ is unknown. Use a t test with the sample standard deviation instead.
  • Chi-squared with small expected counts. The test is unreliable when expected counts are small; a common rule is that each should be at least 5.

Practise hypothesis testing in a short timed paper

Hypothesis tests and p-values come up in AP Statistics practice, and in A-level Maths: Statistics in the UK. Each daily paper is a short timed paper of 8 questions worth 25 to 35 marks, and the papers mix topics, so not every paper has a test in it.

Common questions

What is a p-value?
The probability of getting a result at least as extreme as yours if the null hypothesis were true. The smaller it is, the stronger the evidence against the null hypothesis.
What does p &lt; 0.05 mean?
The result is significant at the 5% level: if H₀ were true, a result this extreme would happen less than 5% of the time, so you reject H₀.
How do you find a p-value from a t score?
You need the degrees of freedom too. In the Hypothesis Test Calculator, use a one-sample t test with the mean to test at 0, n one more than the degrees of freedom, SD equal to √n and the mean equal to your t.
How do you calculate chi-square?
For each category, work out (observed − expected)² ÷ expected, then add them up. Compare the total with the chi-square distribution for the right degrees of freedom to get the p-value.
What is the difference between a one-tailed and a two-tailed test?
A two-tailed test looks for a difference in either direction; a one-tailed test looks in one direction only. The one-tailed p-value is half the two-tailed one when the result is in the predicted direction.
Is a smaller p-value a bigger effect?
Not necessarily. A tiny effect can give a small p-value with a large enough sample. The p-value measures evidence, not size.

Revision cards

Say the answer first, then flip the card to check it.

Where to go next

  • Solve it

    Hypothesis Test Calculator

    Run z, t and chi-squared tests and read off the p-value

    Open the tool
  • Test it

    AP Statistics

    A new exam-style paper every day, with instant marking and a mark scheme

    Start today's paper
Read next
Maths · StatisticsExpected value calculator: E(X), variance and SDFree expected value calculator: enter outcomes and probabilities, as decimals or fractions, to get E(X), the variance and standard deviation, with steps.