P value from confidence interval calculator

This P value from confidence interval calculator works back from a published interval: the standard error is the CI’s width divided by 2 × 1.96, z is the estimate divided by that SE, and P comes from z. It also runs the other way, giving a confidence interval from a P value, following Altman and Bland.

Updated

Runs in your browser. Nothing you enter is uploaded, stored or sent anywhere.

How to get a P value from a 95% confidence interval, and back

Both directions rest on the same normal approximation, set out by Altman and Bland in two short notes: P from a CI and a CI from P. The Cochrane Handbook uses the same relations to get standard errors for meta-analysis (6.3.1 and 6.3.2).

Altman and Bland’s steps, for a 95% interval with limits l and u.

  • P from a CI

    Step 1
    SE = (u − l) ÷ (2 × 1.96)
    Step 2
    z = Est ÷ SE
    Step 3
    P from z, two-sided
  • CI from P

    Step 1
    z from P, two-sided
    Step 2
    SE = |Est| ÷ z
    Step 3
    Est ± 1.96 × SE

For a ratio (a risk ratio, odds ratio or hazard ratio), take natural logs of the estimate and both limits first, and exponentiate the interval at the end. Ratios’ intervals are symmetric only on the log scale.

Altman and Bland give pocket-calculator formulas for the normal distribution: P = exp(−0.717z − 0.416z²) and z = −0.862 + √(0.743 − 2.404 ln P). This calculator uses the exact normal distribution instead, and the exact multiplier for the level (1.959964 for 95%, 1.644854 for 90%, 2.575829 for 99%), and shows the pocket formula’s answer beside it.

Worked examples from Altman and Bland

The calculator opens on the ratio examples from the two notes.

Example: P from a CI: a hazard ratio of 0.81 (95% CI 0.70 to 0.94)

On the log scale, Est = ln 0.81 = −0.211, l = ln 0.70 = −0.357 and u = ln 0.94 = −0.062.

SE = (u − l) ÷ (2 × 1.96) = 0.0752 (Altman and Bland, working from the rounded logs, get 0.0753), and z = −0.211 ÷ 0.0752 = −2.80.

The exact two-sided P is 0.0051. Altman and Bland’s pocket formula gives 0.005, the figure in their note.

Example: A CI from P: a relative risk of 0.30 with P = 0.034

For P = 0.034, z = 2.120 (the pocket formula gives 2.117). Est = ln 0.30 = −1.204, so SE = 1.204 ÷ 2.120 = 0.568.

The 95% CI on the log scale is −1.204 ± 1.96 × 0.568 = −2.317 to −0.091, which is 0.10 to 0.91 as a relative risk, as in the note.

For their difference examples: a mean difference of 1.9 mm Hg (95% CI −0.6 to 4.3) gives P = 0.13, as the trial reported; and a difference of 17 percentage points with P = 0.032 gives a 95% CI of 1.5 to 32.5 here. The note, using the pocket formula, has 1.4 to 32.6.

Limits of the method

  • Small samples. The method assumes a normal (z) test. It isn’t right for small studies analysed with a t test or analysis of variance, or for a binary outcome with an exact interval, though it’s close enough with about 60 or more patients (Altman and Bland). For a mean difference from a small trial, the Cochrane Handbook uses the t distribution instead (6.5.2.3).
  • P values given as inequalities. If a paper says P < 0.001, setting P = 0.001 makes z too small, so the interval comes out too wide: the estimate is more precise than it looks. If it says P > 0.05 or “not significant”, setting P = 0.05 makes the interval too narrow. Type the inequality (such as “< 0.001”) and the calculator says which way it errs.
  • Very small P values. The pocket formula is unreliable below 0.0001; Altman and Bland suggest reporting such a P as P < 0.0001, and this calculator does.
  • An estimate that isn’t central. If the estimate isn’t in the middle of its interval on the scale you chose, the calculator warns you. The usual reasons are a ratio entered as a difference (or the other way round), heavy rounding, or an interval that wasn’t built this way.

What to report

What to report: Say the number was derived

When a P value or an interval in your review was calculated rather than reported, say so, name the method (Altman and Bland 2011), and give the published numbers it came from. If the source gave P as an inequality, say that the derived interval is only a bound.

OtterSR’s meta-analysis takes a study’s estimate and 95% CI the same way, deriving the standard error from the interval’s width. See how OtterSR works.

Frequently asked questions

How do I get a P value from a 95% confidence interval?

Divide the interval’s width by 3.92 (2 × 1.96) to get the standard error, divide the estimate by the SE to get z, and look up the two-sided P for z. For a ratio, do all of this with the logs of the estimate and limits.

Can I calculate a confidence interval from a P value?

Yes, if you have the estimate. Find z for the two-sided P, divide the estimate by z to get the SE, and go 1.96 SEs either side. It doesn’t work for an estimate of no effect (0, or 1 for a ratio), where z is 0.

Why does it matter whether it’s a ratio?

A ratio’s interval is built on the log scale, so it’s lopsided on the ratio scale: 0.70 to 0.94 around 0.81 is symmetric only once you take logs. Treating it as a difference gives the wrong SE.

What if the interval is 90% or 99%?

Choose the level above. The multiplier becomes 1.645 for 90% and 2.576 for 99% instead of 1.96.

How to cite this tool

OtterSR. P value from confidence interval calculator. https://www.ottersr.com/tools/p-value-from-confidence-interval (accessed today’s date).

Please cite the method as well:

  • Altman DG, Bland JM. How to obtain the P value from a confidence interval. BMJ 2011;343:d2304.

  • Altman DG, Bland JM. How to obtain the confidence interval from a P value. BMJ 2011;343:d2090.

Sources

  1. Altman DG, Bland JM. How to obtain the P value from a confidence interval. BMJ 2011;343:d2304. https://doi.org/10.1136/bmj.d2304
  2. Altman DG, Bland JM. How to obtain the confidence interval from a P value. BMJ 2011;343:d2090. https://doi.org/10.1136/bmj.d2090
  3. Higgins JP, Li T, Deeks JJ (editors). Chapter 6: Choosing effect measures and computing estimates of effect [last updated August 2023]. In: Higgins JP, Thomas J, Chandler J, et al (editors). Cochrane Handbook for Systematic Reviews of Interventions version 6.5. Cochrane, 2024. https://www.cochrane.org/authors/handbooks-and-manuals/handbook/current/chapter-06