Key Takeaways
- Use a t-test for a mean when the population standard deviation is unknown.
- Use a z-test for a mean when the population standard deviation is known. For proportions, the test is usually a z-test when the normal conditions are met.
- The t-distribution has heavier tails than the normal distribution, especially for small samples, and it gets closer to normal as sample size grows.
t test vs z test can feel confusing because both tests compare a sample to a claim. The hard part is knowing which one fits your data.
This guide gives you a simple rule, clear steps, and worked examples. You are not behind. You just need a clear method.

Quick answer
A t-test and a z-test are both hypothesis tests (methods used to check whether sample data support a claim). The main difference is this: for means, use a z-test when the population standard deviation σ is known, and use a t-test when σ is unknown and you use the sample standard deviation s instead. For proportions, you usually use a z-test if the sample is large enough for the normal approximation.
Mini-rule:
- Check what you are testing: mean or proportion.
- If it is a mean, ask whether σ is known.
- If σ is known, use z. If σ is unknown, use t.
For one-sample means, the formulas are:
Where:
- = sample mean (average from your sample)
- = claimed population mean
- = population standard deviation
- = sample standard deviation
- = sample size
What is the difference between a t-test and a z-test?
A test statistic is a number that shows how far your sample result is from the claim in the null hypothesis. Both tests measure distance in standard error units, but they use different distributions.
Main difference
| Feature | t-test | z-test |
|---|---|---|
| Usually used for | Means | Means or proportions |
| Standard deviation used | Sample standard deviation s | Population standard deviation σ |
| Distribution used | t-distribution | Standard normal distribution |
| Best known classroom rule | Use when σ is unknown | Use when σ is known |
| Small sample behavior | Safer because t has heavier tails | Less common for means in real life |
This rule is the safest beginner rule for means:
- Unknown σ → t-test
- Known σ → z-test
Why the t-distribution is different
The t-distribution is a curve like the normal curve, but with heavier tails (more area in the ends). That extra spread accounts for the fact that you are estimating the population standard deviation with sample data. As the sample size gets bigger, the t-distribution becomes closer to the normal distribution.

Key terms you need to know
- Mean (average value).
- Population (the whole group you want to study).
- Sample (the smaller group you actually measure).
- Standard deviation (how spread out the data are).
- Population standard deviation σ (true spread in the full population).
- Sample standard deviation sss (spread measured from your sample).
- Hypothesis test (a method for checking a claim using sample data).
- Null hypothesis (the claim you test first, often “no difference” or “equals”).
- Alternative hypothesis (the competing claim).
- p-value (how surprising your sample result would be if the null hypothesis were true).
- Degrees of freedom, df (how many values can vary freely after a rule is used). For a one-sample t-test, .
Why does t use n−1?
When you compute the sample standard deviation, you first use the sample mean. After that, only n−1 deviations can vary freely because the deviations must add up to zero. That is why the degrees of freedom for the one-sample t-distribution are .
When to use t-test vs z-test
Use a t-test when:
- You are testing a mean.
- The population standard deviation is unknown.
- The population is roughly normal, or the sample is large enough for the method to work well.
Use a z-test when:
- You are testing a mean and the population standard deviation is known.
- You are testing a proportion and the normal conditions are met.
Important note about “sample size 30”
Many students learn this shortcut:
- “If , use z.”
That shortcut is too simple by itself. For means, the better classroom rule is still about whether σ is known. In real problems, is often unknown, so the t-test is often the better choice for means, even with larger samples.
t-test vs z-test decision table
| Question | Use this |
|---|---|
| Testing one mean, known | z-test |
| Testing one mean, unknown | t-test |
| Testing one proportion, conditions met | z-test |
| Comparing means with unknown population standard deviations | usually a t-based method |

Step-by-step method
Use this process when your teacher asks you to choose the test and solve.
Step 1: Identify the variable
Ask: are you testing a mean or a proportion?
- Mean examples: average height, average score, average wait time
- Proportion examples: percent who passed, fraction who prefer tea, share of defective items
Step 2: Write the hypotheses
Example:
Or for a proportion:
Step 3: Check what standard deviation you have
- If the problem gives population standard deviation σ for a mean, use z.
- If it only gives sample data and you must compute s, use t.
Step 4: Choose the formula
For one mean:
Step 5: Compute the test statistic
Plug in the numbers carefully.
Step 6: Find the p-value or compare with a critical value
Use your calculator, table, or software.
Step 7: Make the decision
- If , reject .
- If , fail to reject .
Step 8: Write the conclusion in words
Answer the question in context.
What to write on your paper
Use this mini-checklist:
- Parameter: mean or proportion
- and
- Test used: t-test or z-test
- Given values: , , , and or
- Test statistic
- p-value or critical value
- Decision
- Final sentence in context
Quick self-check
Ask yourself:
- Did I test a mean or a proportion?
- Did I use σ or s correctly?
- Does my conclusion match the direction of ?
- Did I write the conclusion in words, not just symbols?

Worked examples
Example 1
A juice factory says its bottles have an average fill of 500 mL. The population standard deviation is known: mL. A sample of bottles has mean mL. At , test whether the true mean differs from 500 mL.
Step 1: Hypotheses
Step 2: Choose the test
This is a test about a mean, and σ is known. Use a z-test.
Step 3: Compute the test statistic
Why this step happens: the formula measures how far the sample mean is from the claim in standard error units.
Step 4: Decision
For a two-tailed test at , gives a p-value a little below 0.05, so reject .
Final answer
There is enough evidence at the 5% level to say the mean fill is different from 500 mL.
Example 2: Typical homework one-sample t-test
A teacher says the average study time before a quiz is 4 hours. A sample of 16 students has:
- hours
- hours
Test at whether the average study time is greater than 4 hours.
Step 1: Hypotheses
Step 2: Choose the test
This is a test about a mean, but the population standard deviation is unknown. Use a t-test.
Step 3: Compute the test statistic
Step 4: Degrees of freedom
Step 5: Decision
For a right-tailed test with , gives a p-value below 0.05, so reject .
Final answer
There is enough evidence to say the average study time is greater than 4 hours.
Example 3: Mean or proportion?
A school says 60% of students bring lunch from home. You sample 100 students and find 68 bring lunch.
Step 1: Identify the parameter
This is a proportion, not a mean.
Step 2: Choose the test
For one population proportion, the usual classroom method is a z-test when the conditions for the normal approximation are met.
Why this matters
Some students see a sample size of 100 and think “t-test because sample data.” That is wrong here because the variable is a proportion, not a mean.
Example 4: Exam-style trick question
A problem says:
“A sample of 40 light bulbs has mean life 810 hours. The company claims the mean is 800 hours. The sample standard deviation is 50 hours.”
Which test?
Correct choice
Use a t-test.
Why
You are testing a mean, and the problem gives sample standard deviation s, not population standard deviation σ. Even though , the safer rule for means is still based on whether is known.
Practice set
Try these before checking the answers.
- A company claims the average battery life is 20 hours. You know hours. A sample of 25 batteries has . Which test?
- A class average is claimed to be 75. A sample of 10 students has and . Which test?
- A survey checks whether more than 45% of students prefer online notes. Out of 200 students, 110 say yes. Which test?
- A sample of 36 plants has cm and cm. The claim is cm. Which test?
- A hospital says the average waiting time is 30 minutes. You know the population standard deviation is 8 minutes. A sample of 49 patients has mean 28 minutes. Which test?
- A school says 70% of students pass a screening test. In a sample of 120 students, 78 pass. Which test?
- A sample of 12 quiz scores has mean 81 and sample standard deviation 5. The claim is 80. Which test?
- Common trap: A sample of 100 people is used to test whether the average height differs from 170 cm. The problem gives cm, not . Which test?
Answer key
- z-test
- t-test
- z-test for one proportion
- t-test
- z-test
- z-test for one proportion
- t-test
- t-test
Short solutions for 2 items
Item 1:
Testing a mean with known σ, so use z-test.
Item 8:
Large sample, but still a mean with unknown population standard deviation. Since only is given, use t-test.

Common mistakes: t test vs z test
| Mistake | Why it happens | Do this instead |
|---|---|---|
| Using z-test just because | Students memorize a shortcut and stop there | For means, first ask whether σ is known |
| Using t-test for proportions | “Test” sounds the same, so students mix variable types | Check the parameter first: mean or proportion |
| Mixing up and | Both are standard deviations | s is from the sample, σ is the population value |
| Forgetting degrees of freedom in t-test | Students rush to compute | For one-sample t, use |
| Writing a math-only conclusion | Students stop after the p-value | Always write one sentence in context |
| Choosing the wrong tail | Students do not read the claim carefully | Match the sign in Ha: , , or |
If you get stuck…
“I don’t know what formula to use.”
Start by asking: am I testing a mean or a proportion? Then ask whether σ is known.
“I keep mixing up t and z.”
Use this memory line:
- t → mean with unknown population standard deviation
- z → mean with known population standard deviation, or many proportion tests
“My calculator gives a different value.”
Check:
- Did you enter or s correctly?
- Did you choose one-tailed or two-tailed correctly?
- Did you use the right degrees of freedom for t?
“I do not know whether the answer should be negative.”
The test statistic can be negative. That usually just means the sample mean is below the claimed mean.
“I do not know the prerequisite ideas.”
Review hypothesis testing basics and test selection first:
“I still do not get why this is t and not z.”
That is normal. Ask your teacher or tutor to show one problem where σ is known and one where it is unknown. Seeing both side by side usually helps.
Next steps
- How to Choose the Right Statistical Test — Start here if you want a bigger map of when to use each test.
- Statistical Test Selector — Use this tool when you are unsure which test fits your homework or project.
- t-Distribution Calculator — Helpful when your problem uses a t-test and you need tail areas or critical values.
- Confidence Interval Calculator — Good next step because confidence intervals and hypothesis tests are closely connected.
- parametric vs nonparametric tests — Read this next if your class is moving beyond basic test choice and into assumption checks.
- one tailed vs two tailed test — Read this next if you keep getting confused about the direction of the alternative hypothesis.
How we know
- This guide follows standard classroom rules for choosing between one-sample mean z-tests and t-tests.
- The explanation of the t-distribution and its heavier tails matches standard introductory statistics texts.
- The explanation of degrees of freedom n−1 follows standard textbook treatment of the sample standard deviation and Student’s t-distribution.
- The point that one-sample proportion tests commonly use a z-test comes from standard intro statistics materials.
- Worked steps were checked against standard hypothesis-testing structure used in university statistics instruction.
Use this the right way
Use this guide to learn the method, not to skip the learning. Write your own steps in your own words when you do homework or research. If you use outside sources in a report or paper, cite them properly and avoid plagiarism.
Reference
Pennsylvania State University. (n.d.). 8.2.3 Hypothesis testing. STAT 200. https://online.stat.psu.edu/stat200/lesson/8/8.2/8.2.3
OpenStax. (2023). 8.2 A single population mean using the Student t distribution. In Introductory Statistics 2e. https://openstax.org/books/introductory-statistics-2e/pages/8-2-a-single-population-mean-using-the-student-t-distribution
OpenStax. (2023). 9.5 Additional information and full hypothesis test examples. In Introductory Statistics 2e. https://openstax.org/books/introductory-statistics-2e/pages/9-5-additional-information-and-full-hypothesis-test-examples


