In a scientific experiment, a confounding variable is a secondary, changing condition that muddies the experimenter's hypothesized inference between cause and effect. Researchers must be meticulous about experiment design to control for confounding variables and to protect the integrity of their findings.
At its core, an experiment seeks to answer the question, "Can one chosen thing cause a change in another chosen thing?" In research terminology, the thing causing the change is the independent variable, and the thing being changed is the dependent variable. As an example, in an experiment designed to test the effect of background music on workers' productivity, the independent variable is the music, and the dependent variable is productivity. Worker production is measured with music and again without music. If there is a measured change in productivity and all secondary influences remain the same except the music, the researcher can reasonably conclude that the music caused the change. But if there is a secondary change such as a change in room temperature coinciding with the change in music, the researcher cannot tell if the music or the temperature caused the difference in productivity. Temperature is a confounding variable.
Before conducting an experiment, the researcher's job is to consider all potential conditions that can confound an experiment and invalidate its results. If a researcher fails to control for confounding variables, the experiment findings are unreliable.