P-Value Calculator
Test a sample mean against a null hypothesis and get the p-value, the z statistic and both one- and two-tailed results.
Formula and sources updated · Data sources · 1View algorithm, constants and default inputs (JSON)
About this calculator
This z-test assumes independent observations and a known population standard deviation. Choose the direction for the one-tailed alternative; the two-tailed result tests for a difference in either direction. A p-value is not the probability that a hypothesis is true.
Worked example
calculated with the default values below
Sample mean 102 · Hypothesised mean 100 · Standard deviation 15 · Sample size 30 · Test type Two-tailed · One-tailed alternative Sample mean is greater P-value 0.4652 · Z statistic 0.730 · One-tailed p-value 0.2326 · Two-tailed p-value 0.4652 · Standard error 2.7386 Not significant
Method and assumptions
z = (x − m0) ÷ (s ÷ √(n)); p_upper = 1 − Φ(z); p_lower = Φ(z); p_two = 2 × [1 − Φ(|z|)]; Φ(z) = 0.5 × [1 + erf(z ÷ √(2))] Computes a one-sample z statistic (sample mean − null mean)/(known SD/√n) and normal-tail probabilities. Sample size must be an integer. This assumes independent observations and a known population SD; it is not a t-test. This z-test assumes independent observations and a known population standard deviation. Choose the direction for the one-tailed alternative; the two-tailed result tests for a difference in either direction. A p-value is not the probability that a hypothesis is true. The references explain definitions and methods; any extra preset must be checked against the assumptions on this page.
Data sources
The references explain definitions and methods; any extra preset must be checked against the assumptions on this page.
Disclaimer
These calculators give general mathematical results. They suit study, planning and estimation — verify anything that feeds a graded submission, a published figure or a financial commitment.
Implementation source
This record describes the implementation used by this page. It is not independent validation. External references, when available, support only the stated formula or definition; estimates and custom rules retain their own assumptions.
Formula and variables
z = (x − m0) ÷ (s ÷ √(n)); p_upper = 1 − Φ(z); p_lower = Φ(z); p_two = 2 × [1 − Φ(|z|)]; Φ(z) = 0.5 × [1 + erf(z ÷ √(2))]
- x
- Sample mean
- m0
- Hypothesised mean
- s
- Population standard deviation
- n
- Sample size
- N
- Standard normal CDF
Computes a one-sample z statistic (sample mean − null mean)/(known SD/√n) and normal-tail probabilities. Sample size must be an integer. This assumes independent observations and a known population SD; it is not a t-test.
Frequently asked questions
Why must the sample size be a whole number?
A sample size counts observations, so it must be an integer. This calculator uses a one-sample z test with a known population standard deviation and assumes independent observations; it is not a t test.
When should I choose greater or less for a one-tailed test?
Choose “greater” when the alternative hypothesis predicts a mean above the null mean, and “less” when it predicts a mean below it. Set the direction before examining the data. If departures in either direction matter, use a two-tailed test.
Which inputs and limits apply to P-Value Calculator?
Use the units shown beside each field. These are form limits, not recommended settings. Sample mean: -1,000,000–1,000,000; Hypothesised mean: -1,000,000–1,000,000; Standard deviation: 0.0001–1,000,000; Sample size: 2–10,000,000 z = (x − m0) ÷ (s ÷ √(n)); p_upper = 1 − Φ(z); p_lower = Φ(z); p_two = 2 × [1 − Φ(|z|)]; Φ(z) = 0.5 × [1 + erf(z ÷ √(2))] Computes a one-sample z statistic (sample mean − null mean)/(known SD/√n) and normal-tail probabilities. Sample size must be an integer. This assumes independent observations and a known population SD; it is not a t-test. This z-test assumes independent observations and a known population standard deviation. Choose the direction for the one-tailed alternative; the two-tailed result tests for a difference in either direction. A p-value is not the probability that a hypothesis is true. The references explain definitions and methods; any extra preset must be checked against the assumptions on this page.
What is a complete worked example for Sample mean = 102; Hypothesised mean = 100?
Inputs: Sample mean = 102; Hypothesised mean = 100; Standard deviation = 15; Sample size = 30; Test type = Two-tailed; One-tailed alternative = Sample mean is greater. Calculation: z = (x − m0) ÷ (s ÷ √(n)); p_upper = 1 − Φ(z); p_lower = Φ(z); p_two = 2 × [1 − Φ(|z|)]; Φ(z) = 0.5 × [1 + erf(z ÷ √(2))]. Results: P-value = 0.4652; Z statistic = 0.730; One-tailed p-value = 0.2326; Two-tailed p-value = 0.4652; Standard error = 2.7386.