What Is a Confounding Variable? Definition, Examples and How to Control It

Dr. Rajni Garg
Executive Lead, Research & Content Strategy
7 min read
A confounding variable is a third factor that is linked to both the exposure and the outcome in a study. It can make the link between them look stronger, weaker or even reversed.
This guide gives seven examples from four fields. It then shows how a confounder differs from other variables, how to spot one in a study and how to control it.
TL;DR
A confounding variable affects both the exposure and the outcome.
It is not on the causal path between them. A variable on that path is a mediator.
Control it in the design with randomization, restriction or matching.
Control it in the analysis with stratification or multivariable regression.
Adjustment only works for the confounders you measured.
What is a confounding variable?
A confounding variable, also called a confounder, mixes its own effect with the effect you want to study. You then cannot tell which one produced the result.
Here is a classic teaching example. A study finds that people who drink more coffee have more heart disease. But the coffee drinkers in the study also smoke more, and smoking raises the risk of heart disease. Smoking is the confounding variable. If you ignore it, coffee looks harmful when it may not be.
In this guide, the exposure is the cause you are studying and the outcome is the effect. In an experiment, these are the independent variable and the dependent variable. Our guide on independent and dependent variables explains both.
Three checks for a confounder
A variable is a confounder only if it passes all three checks the following way.
It is linked to the exposure.
It affects the outcome.
It is not on the causal path between the exposure and the outcome.
Smoking passes all three in the coffee example. Smokers drink more coffee, smoking affects the heart, and smoking is not a step between coffee and heart disease.
Confounding variable examples
The examples below are simplified for teaching. In each one, the third variable explains part or all of the link.
Field | What the data show | Confounding variable |
|---|---|---|
Health | Coffee drinkers have more heart disease. | Smoking. Smokers drink more coffee and have more heart disease. |
Health | Patients on a new drug recover more slowly. | Severity of illness. Doctors gave the drug to the sickest patients. |
Public health | Drownings rise when ice cream sales rise. | Hot weather. Heat raises both swimming and ice cream sales. |
Education | Pupils with bigger shoes read better. | Age. Older children have bigger feet and more reading practice. |
Education | Students in tutoring get lower grades. | Prior achievement. Students who struggle are more likely to seek tutoring. |
Psychology | Clients who attend more therapy sessions improve more. | Motivation. Motivated clients attend more sessions and also work harder on change. |
Business | Sales are higher in months with more advertising. | Season. Both advertising and sales rise before the holidays. |
Look at the drug example and the tutoring example. Both treatments look harmful only because of who received them. This is how confounding can reverse a result.
Confounding vs extraneous, mediating and moderating variables
These four terms are easy to mix up. The table shows the difference.
Variable | What it does | Example |
|---|---|---|
Extraneous | Any variable outside your study that could affect the outcome. | Room noise during a memory test. |
Confounding | An extraneous variable that is also linked to the exposure. | Smoking in the coffee example. |
Mediating | A step on the causal path. It explains how the exposure works. | Tutoring raises study time, and study time raises grades. |
Moderating | Changes how strong the effect is. It shows for whom or when the effect holds. | Tutoring helps beginners more than advanced students. |
Every confounder is an extraneous variable, but not every extraneous variable is a confounder. Room noise that affects all groups equally adds error. It does not create a false link.
The key difference between a confounder and a mediator is position. A confounder is off the causal path. A mediator is on it.
How do you spot confounding when you read a study?
Check the design. If people were not assigned to groups at random, confounding is possible.
Read the baseline table. See whether the groups differ in age, sex, health or income at the start.
List what could affect both the exposure and the outcome. Then check whether the authors measured those variables.
Compare the crude and adjusted results. A large change after adjustment is a sign of confounding.
Read the limitations. Look for confounders the authors could not measure.
How do you control a confounding variable?
You can control confounding at two stages: when you design the study and when you analyze the data. Start with the design, because it can prevent the problem.
In the study design
Randomization. Assign people to groups by chance. On average, this balances the confounders you know and the ones you do not.
Restriction. Include only one level of the confounder, such as non-smokers only. Your results then apply only to that group.
Matching. Give each person a comparison person with the same value of the confounder, such as the same age and sex.
In the analysis
Stratification. Split the data by the confounder and analyze each group separately. For example, compare coffee drinkers and non-drinkers among smokers, then among non-smokers.
Multivariable regression. Put the exposure and several confounders in one model. The model estimates the effect of the exposure while it holds the confounders constant.
Analysis methods can adjust only for confounders that you measured. Decide which ones to measure before you collect data.
How do reviewers judge confounding?
Confounding is one of the first things reviewers check in a study that did not use randomization. Two common appraisal tools show how.
ROBINS-I has seven bias domains. The first is “bias due to confounding” (Sterne et al., 2016).
Newcastle-Ottawa Scale has a Comparability section. It asks whether the study controlled for the most important factor and for any additional factor, in the design or the analysis. A study can earn up to two stars in this section.
If you are writing a paper, name your main confounders and say how you controlled each one. Reviewers will look for this.
The AnswerThis risk of bias assessment tool assesses one study at a time. It gives draft answers linked to evidence from the paper, using RoB 2, ROBINS-I, QUADAS-2, the Newcastle-Ottawa Scale (cohort and case-control forms) or JBI. The first study is free. A reviewer must confirm each answer.
What are the most common mistakes?
Calling every extra variable a confounder. A confounder must be linked to both the exposure and the outcome.
Adjusting for a mediator. This removes part of the real effect, because the mediator is how the exposure works.
Assuming adjustment removes all confounding. Confounders that were not measured, or were measured poorly, still bias the result. This is called residual confounding.
Treating “no significant difference between the groups” as proof. The Newcastle-Ottawa coding manual does not accept that statement as evidence that the groups are comparable.
Plan a study that controls for confounding
The AnswerThis methodology generator organizes your study plan into design, participants, procedure, measures and analysis. Paste your plan, including the confounders you will measure and how you will control each one. Any decision you have not made yet stays visible as a placeholder. You get 3 free runs. The statistical analysis itself is still yours to confirm with your adviser or a statistician.

FAQs
What is a confounding variable in simple terms?
It is a third factor that affects both the cause and the effect you are studying. It makes the two look more related, or less related, than they really are.
Is a confounding variable the same as an extraneous variable?
No. An extraneous variable is any outside variable that could affect the outcome. It becomes a confounding variable only when it is also linked to the exposure.
What is the difference between a confounder and a mediator?
A confounder is off the causal path and should be controlled. A mediator is on the causal path, so adjusting for it hides part of the effect.
Does randomization remove confounding?
Randomization balances confounders across groups on average, including ones you did not measure. In a small study the groups can still differ by chance, so check the baseline table.
What is residual confounding?
It is the confounding that remains after adjustment. It comes from confounders that were not measured or were measured poorly.
Is a lurking variable the same as a confounding variable?
Many introductory textbooks use the two terms in a similar way. A lurking variable usually means a third variable that the study did not measure.




