Written and maintained by CASRAI Editorial Board
Published · Last updated
On this page
A two-tailed hypothesis test asks whether a parameter differs from a stated value in either direction. You split the significance level α across both tails of the test statistic’s distribution and reject the null hypothesis when the statistic lands far enough out on either side. This page gives the rule, a worked example with every step of the arithmetic, and the code to reproduce it.
Definition in one paragraph
In a two-tailed test (also called a two-sided or non-directional test), the alternative hypothesis states only that the parameter is not equal to the null value. For two means, NIST/SEMATECH writes the hypotheses as H0: μ1 = μ2 against Ha: μ1 ≠ μ2. Because a difference in either direction counts as evidence against H0, the rejection region sits in both tails. If you only want to detect an increase or only a decrease, that is a one-tailed test; the one-tailed vs two-tailed test comparison covers when each is legitimate. For the null hypothesis itself, see null hypothesis explained. For how the two competing hypotheses are framed side by side, see the null vs alternative hypothesis comparison.
Hypothesis testing two-tailed: the rejection rule and formula
The NIST/SEMATECH e-Handbook gives the rejection regions for the two-sample t-test. Its test statistic is
T = (Ȳ1 − Ȳ2) / √(s1²/N1 + s2²/N2)
- Ȳ1, Ȳ2: the two sample means.
- s1², s2²: the two sample variances.
- N1, N2: the two sample sizes.
- α: the significance level you fixed before looking at the data (for example 0.05).
- ν: the degrees of freedom of the t distribution.
- t1−α/2,ν: the critical value that leaves α/2 in the upper tail.
The handbook’s rejection regions for the three possible alternatives are:
| Alternative hypothesis | Reject H0 if | Tails |
|---|---|---|
| μ1 ≠ μ2 | |T| > t1−α/2,ν | Two |
| μ1 > μ2 | T > t1−α,ν | One (upper) |
| μ1 < μ2 | T < tα,ν | One (lower) |
The vertical bars mean absolute value, so |T| > t1−α/2,ν is the same as “T is above the upper critical value or below its negative.” With α = 0.05, each tail holds 0.025. When the reference distribution is the standard normal, that cutoff is z = ±1.96; for a t distribution it depends on the degrees of freedom and is always larger in size than 1.96. To look up or compute these cutoffs, see how to find a critical value and what the t distribution is.
Worked example with real numbers
Example 1: two-sample test on published data (NIST)
The NIST/SEMATECH handbook tests whether the mean fuel economy (miles per gallon) of U.S. and Japanese cars differs, using the AUTO83B data set:
- U.S. cars: N1 = 249, mean = 20.14458, standard deviation = 6.41470
- Japanese cars: N2 = 79, mean = 30.48101, standard deviation = 6.10771
- Test statistic T = −12.62059, degrees of freedom ν = 326, α = 0.05
The two-tailed critical value is t1−α/2,ν = 1.9673. Because |T| = 12.62059 is greater than 1.9673, the handbook rejects H0 and concludes the means differ. For contrast, the upper one-tailed critical value at the same α and ν is 1.6495: the two-tailed cutoff is further out because only 0.025 is placed in each tail instead of 0.05 in one.
Example 2: one-sample test, arithmetic shown
Suppose a sample of n = 25 has mean x̄ = 52.4 and standard deviation s = 6, and you test H0: μ = 50 against Ha: μ ≠ 50 at α = 0.05.
- Standard error: s/√n = 6/√25 = 6/5 = 1.2
- Test statistic: t = (52.4 − 50)/1.2 = 2.4/1.2 = 2.000
- Degrees of freedom: n − 1 = 24
- Two-tailed critical value: t0.975,24 = 2.0639, so the rejection region is t > 2.0639 or t < −2.0639
- Decision: |2.000| < 2.0639, so you do not reject H0
- Two-tailed p-value: 2 × P(T24 > 2.000) = 2 × 0.02847 = 0.0569, which is above 0.05, matching the decision
- 95% confidence interval: 52.4 ± 2.0639 × 1.2 = 52.4 ± 2.48, or (49.92, 54.88); it contains 50
The same data tested one-tailed (Ha: μ > 50) give p = 0.0285 and would be rejected at 0.05. That is exactly why the direction must be fixed before seeing the data (see mistakes below). All figures in Example 2 were computed with SciPy and double-checked by hand.
Interpretation: how to read the result
| What you see | Reading |
|---|---|
| |T| greater than the two-tailed critical value | Reject H0. The statistic is in the rejection region in whichever tail it falls. |
| |T| less than or equal to the critical value | Do not reject H0. This is not proof the values are equal. |
| Two-tailed p ≤ α | Reject H0 (equivalent to the critical-value rule). |
| Confidence interval (1 − α) excludes the null value | Reject H0 at level α; if it contains the null value, do not reject. |
| Negative T with a large |T| | Still significant: the sign shows direction (sample 1 lower, as in Example 1), the rule uses |T|. |
For a statistic with a symmetric distribution such as t or z, the two-tailed p-value is twice the one-tailed p-value for the observed direction, as Example 2 shows (0.0285 × 2 ≈ 0.0569). For more on reading the statistic itself, see how to interpret the t-statistic.
Assumptions and common mistakes
- Choosing the direction after seeing the data. Switching to a one-tailed test because the sample moved one way halves the p-value and inflates the false-positive rate. Decide, and record, the alternative beforehand.
- Using a signed T in the comparison. The two-tailed rule compares |T| to the critical value, or checks both tails.
- Using the one-tailed critical value. At α = 0.05 and ν = 326 that is 1.6495, not 1.9673; using it rejects too easily.
- Reading “fail to reject” as “no difference.” It means the data did not provide enough evidence at level α.
- Ignoring the test’s own conditions. The t statistic assumes independent observations and sampling from an approximately normal population (or a large enough sample); check the conditions of the specific test you use. How to choose a statistical test helps you pick one.
How to report a two-tailed test (APA-style example)
A common reporting pattern gives the statistic, degrees of freedom, exact p-value, the test’s sidedness if it is not the default, and an interval:
A two-tailed one-sample t test showed that the mean (M = 52.40, SD = 6.00) did not differ significantly from 50, t(24) = 2.00, p = .057, 95% CI [49.92, 54.88].
Report the exact p-value rather than “p < .05” when you have it, and state the test as two-tailed (or note any one-tailed choice and its pre-specified justification). See how to report confidence intervals for the interval part.
How to calculate a two-tailed test in Excel, R or Python
Excel
Microsoft documents T.INV.2T(probability, deg_freedom) as the two-tailed inverse of the Student’s t distribution; it finds the value that T.DIST.2T(x, deg_freedom) maps to the probability you supply, so T.DIST.2T gives the two-tailed p-value. For Example 2:
=T.INV.2T(0.05, 24) -> critical value, about 2.0639
=T.DIST.2T(ABS(2), 24) -> two-tailed p-value, about 0.0569
R
The R documentation for t.test lists alternative = c("two.sided", "less", "greater"), with “two.sided” as the default and mu (default 0) as the null value.
x <- c(52, 48, 55, 51, 57, 49, 53, 54)
t.test(x, mu = 50, alternative = "two.sided") # t = 2.2238, df = 7, p-value = 0.0615
qt(0.975, 24) # 2.0639 (two-tailed critical value, df = 24)
Python (SciPy)
SciPy’s ttest_1samp(a, popmean, ..., alternative='two-sided') defaults to the two-sided alternative, which tests whether the mean differs from popmean, and returns the statistic, p-value, degrees of freedom and a confidence interval.
from scipy import stats
x = [52, 48, 55, 51, 57, 49, 53, 54]
res = stats.ttest_1samp(x, popmean=50, alternative="two-sided")
print(res.statistic, res.pvalue) # 2.2238 0.0615
# Example 2 from summary statistics
n, m, mu, s = 25, 52.4, 50, 6
t = (m - mu) / (s / n**0.5) # 2.0
p = 2 * stats.t.sf(abs(t), n - 1) # 0.0569
crit = stats.t.ppf(0.975, n - 1) # 2.0639
FAQ
What does hypothesis testing two-tailed mean?
It means the alternative hypothesis is “not equal,” so the rejection region is split between the two tails, with α/2 in each. A result far above or far below the null value counts as evidence against H0.
What are the two-tailed critical values at α = 0.05?
For a standard normal reference, ±1.96. For a t distribution they depend on the degrees of freedom: ±2.0639 with 24 degrees of freedom and ±1.9673 with 326 (the NIST example).
How does the two-tailed p-value relate to the one-tailed p-value?
For a symmetric reference distribution such as t, the two-tailed p-value is twice the one-tailed value for the direction observed, as in Example 2 (0.0285 and 0.0569).
Sources
- NIST/SEMATECH e-Handbook of Statistical Methods, “Two-Sample t-Test for Equal Means”: itl.nist.gov/div898/handbook/eda/section3/eda353.htm (checked 2026-10-29).
- R Documentation, “Student’s t-Test” (
t.test): stat.ethz.ch/R-manual/R-devel/library/stats/html/t.test.html (checked 2026-10-29). - SciPy documentation,
scipy.stats.ttest_1samp: docs.scipy.org/doc/scipy/reference/generated/scipy.stats.ttest_1samp.html (checked 2026-10-29). - Microsoft Support, “T.INV.2T function”: support.microsoft.com/en-us/office/t-inv-2t-function-ce72ea19-ec6c-4be7-bed2-b9baf2264f17 (checked 2026-10-29).







