Skip to main content
v2026.11,858 entries · CC-BY 4.0

qnorm in R: Syntax, lower.tail and Worked Examples

How to use qnorm in R: syntax, lower.tail and log.p, vectorised calls, edge cases and a pnorm round-trip check, with worked critical-value examples.

Written and maintained by CASRAI Editorial Board

Last updated

qnorm is R’s quantile function for the normal distribution: give it a probability and it returns the value of x that has that much probability at or below it. qnorm(0.975) returns 1.959964, the familiar two-sided 95% critical value. This guide goes past the one-line syntax and covers the argument that trips people up, lower.tail, plus log.p, vectorised calls, edge cases and a round-trip check against pnorm. People also search for it as “r qnorm”; it is the same function.

What qnorm is used for in research

qnorm answers the question “which value cuts off this much of the normal distribution?” In practice that means three jobs:

  • Critical values. The z value for a confidence interval or a hypothesis test, such as qnorm(0.975) for a two-sided 95% level. See z alpha (zα) critical values and how to find a critical value.
  • Percentile cut-offs. The score at the 90th percentile of a variable assumed to be normal with a given mean and standard deviation.
  • Simulation and plotting inputs. Theoretical quantiles for comparing a sample against a normal reference.

qnorm is the inverse of the cumulative distribution function. The concept, with the same operation in Excel and Python, is explained in inverse normal distribution; the distribution itself is described in normal and standard normal distribution.

Install or access

qnorm belongs to the stats package that ships with R, so there is nothing extra to install. R itself comes from the Comprehensive R Archive Network (CRAN). On Windows, the CRAN page cran.r-project.org/bin/windows/base offers the current release as a .exe installer and notes that the build requires UCRT, which has been part of Windows since Windows 10 and Windows Server 2016. For other operating systems, start from cran.r-project.org. The CRAN pages were last checked on 2026-10-29.

Step-by-step: finding a quantile with qnorm

The documented usage is:

qnorm(p, mean = 0, sd = 1, lower.tail = TRUE, log.p = FALSE)

In the R documentation, p is a vector of probabilities, mean a vector of means and sd a vector of standard deviations. Defaults give the standard normal distribution.

  1. Open R or RStudio and start a console or script.
  2. Standard normal quantile. Run qnorm(0.975). Result: [1] 1.959964.
  3. Your own mean and standard deviation. For X ~ N(100, 15), run qnorm(0.975, mean = 100, sd = 15). Result: [1] 129.3995. This is the value below which 97.5% of the distribution lies.
  4. Several probabilities at once. Run qnorm(c(0.025, 0.5, 0.975)). Result: [1] -1.959964 0.000000 1.959964. The 50th percentile of the standard normal is 0, because the distribution is symmetric about its mean.
  5. Upper tail. Run qnorm(0.025, lower.tail = FALSE). Result: [1] 1.959964. See the next section for why this works.

Output and how to read it

What lower.tail changes

By the R documentation, lower.tail = TRUE (the default) means the probabilities are P[X ≤ x]; with FALSE they are P[X > x]. So p is read as the area to the left of the answer by default and to the right of it when you set lower.tail = FALSE.

Call What p means Result
qnorm(0.05) P[X ≤ x] = 0.05 -1.644854
qnorm(0.05, lower.tail = FALSE) P[X > x] = 0.05 1.644854
qnorm(0.95) P[X ≤ x] = 0.95 1.644854

The practical gain: an upper-tail critical value needs no 1 - p arithmetic. qnorm(0.025, lower.tail = FALSE) and qnorm(0.975) return the same number, and writing the tail you mean makes the code easier to check. The same values appear in the R snippets on the CASRAI pages for zα and inverse normal.

What log.p does

With log.p = TRUE, the documentation says the probabilities are given as logarithms. You pass log(p) instead of p, which matters for probabilities too small to represent comfortably. As a check, qnorm(log(0.975), log.p = TRUE) returns the same 1.959964 as qnorm(0.975).

Vectorised arguments

Because p, mean and sd are all documented as vectors, you can pass several values to any of them in one call, for example one probability with several standard deviations, or a column of probabilities from a data frame.

Round-trip check with pnorm

qnorm and pnorm are inverses. pnorm(qnorm(0.975)) returns [1] 0.975. If a value you computed by hand and the output of qnorm disagree, running this round trip separates a wrong p from a wrong tail. The CDF side is covered in probability distribution function of the normal distribution.

Accuracy

The R documentation states that the code is based on a C translation of Wichura (1988), “Algorithm AS 241: The Percentage Points of the Normal Distribution”, Applied Statistics 37(3), 477, which gives precise results up to about 16 digits for log.p = FALSE. The comments in R’s nmath/qnorm.c source describe the same algorithm, with improvements for the extreme tails and for log.p = TRUE. Console output shows 7 significant digits by default; that is a display setting, not the limit of the calculation.

Troubleshooting

The sign is wrong

Almost always a tail problem. A result that should be positive but is negative means p was read as a lower-tail area. Compare the table above, or add lower.tail = FALSE if p is the area to the right.

NaN for a negative standard deviation

The documentation states that a negative sd is an error and returns NaN. Check that the argument holds a standard deviation and not a variance or a negated value.

sd = 0

For sd = 0 the documentation says the result is the limit as sd decreases to 0, a point mass at the mean, so every probability maps to the mean.

p = 0 and p = 1

The quantile function is defined at the two ends of the distribution: p = 0 corresponds to the lower end and p = 1 to the upper end of the range, which for a normal distribution are minus and plus infinity. R’s nmath/qnorm.c source passes -Inf and Inf as these boundary values. What qnorm returns for p outside the range 0 to 1 is not covered here; check the result of your own call before relying on it.

Free alternatives

Every package below inverts the normal CDF; only the name and the argument order change. Use the table when translating code, and see normal distribution in MATLAB for the full cross-walk of density, CDF and quantile functions.

Tool Lower-tail quantile Upper-tail quantile
R (stats) qnorm(p, mean, sd) qnorm(p, mean, sd, lower.tail = FALSE)
Python (SciPy) norm.ppf(p, loc, scale) norm.isf(p, loc, scale)
Excel NORM.INV(p, mean, sd) NORM.INV(1-p, mean, sd)
MATLAB norminv(p, mu, sigma) norminv(1-p, mu, sigma)

R and SciPy are free to download and use; this table does not compare the other products’ licensing. In SciPy, loc and scale are the mean and standard deviation.

FAQ

Is “r qnorm” a different function from qnorm in R?

No. It is the same function; the phrase is just a different word order for the search. Both mean qnorm() from R’s stats package.

What is the difference between qnorm and pnorm?

They are inverses. pnorm(x) takes a value and returns its cumulative probability; qnorm(p) takes a probability and returns the value. pnorm(qnorm(0.975)) returns 0.975.

How do I get a critical value with qnorm?

For a two-sided test at significance level α, use qnorm(1 - alpha/2), or qnorm(alpha/2, lower.tail = FALSE). At α = 0.05 both return 1.959964. For other levels, qnorm(0.95) is 1.644854 and qnorm(0.995) is 2.575829. See zα critical values.

Does qnorm give the left tail or the right tail?

The left tail by default, since lower.tail = TRUE means P[X ≤ x]. Set lower.tail = FALSE for the right tail.

What does qnorm(0.5) return?

0 for the standard normal, and the mean for any other normal distribution, because the distribution is symmetric about its mean.

Sources

Follow CASRAI

Research-administration guidance, standards updates and independent tool reviews.

Ask CASRAI · free to try

Ask about qnorm in R: Syntax, lower.tail and Worked Examples

Ask your first 2 questions free below. Subscribers get 150 a day for $29 a month.

An AI assistant specialized in research administration. It cites the sources behind every answer, labels web answers and says when it can't answer.

Answers draw on CASRAI's guides and dictionary plus the federal and funder documents we index: Federal Register, Grants.gov, Regulations.gov and UKRI.

Works on this site and inside Claude, Cursor and the AI tools you already use.

Everything CASRAI publishes — this page, the dictionary, the guides and the news — stays free to read, with no account and no card.

Referenced across the research world

University of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logoUniversity of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logo
  • University of Cambridge logo
  • Columbia University logo
  • Crossref logo
  • University of Edinburgh logo
  • Harvard University logo
  • University of Oxford logo
  • Princeton University logo
  • Stanford School of Medicine logo
  • University College London logo
  • ORCID logo

View CASRAI adoption →

Ask CASRAI · Regulatory Radar

Research-admin question? Get an answer that links its sources.

An AI assistant specialized in research administration. Every answer links its sources to check before you act. 2 questions free, no account. $29/month after.

  • Answers draw on CASRAI's guides and dictionary plus the federal and funder documents we index: Federal Register, Grants.gov, Regulations.gov and UKRI.
  • Every answer numbers its sources and links each one, so you can check the source yourself.