Diffusion and osmosis are both equilibrium-related processes. Diffusion describes a general behavior of fluids (e.g. gases, liquids, solutions). Osmosis is a specific type of diffusion, occurring when mobility is restricted by a semi-permeable barrier.
To make life easy, here’s an easy visual model to consider. Picture, if you will, an empty room with all exits sealed. Now imagine that two crates containing twenty mice and twenty cats respectively are dumped in one corner of the room. Immediately you will expect to see a scattering of rodents and felines throughout the room in a fairly random pattern of motion. Before long, you’d expect to see a fairly even distribution of cats and mice throughout the room (save for those mice which were already inside of cats). At no point would you expect the cats and mice to crowd back together into the corner of the room. This serves as a basic model of diffusion.
To model osmosis, repeat the same scenario, with one small addition. The corner of the room where the crates of critters are dumped should now be fenced off with a chain link partition. When the crates are emptied, the mice are free to scatter, as they can squeeze through the holes in the fence, but the cats are stuck, faced with an impassable barrier.
Keeping those illustrations in mind, now consider the realm of molecules and atoms. Diffusion is often described as “the tendency for molecules to move from an area of higher concentration to an area of lower concentration”. This observation is a good description of what is observed, and handy to keep in mind when predicting what will happen in a mixture, but it does little to explain why this behavior is observed. Unlike cats or mice, chemicals have no ulterior motives to escape from their neighbors. They don’t feel social anxiety nor fear being eaten. Chemicals move in exactly one way – randomly. Consider what happens when a drop of green food coloring (dye molecules dissolved in water) falls into a glass of water. At the first instant, all of the green is concentrated at the point of impact, surrounded by colorless water. Swiftly, tendrils of green spread out into the rest of the water, ever broadening as they are spread by the random interactions with one another and with water molecules. Given enough time, the entire solution is a uniformly pale green. It is the nature of random motion that there will always be more molecules moving away from a concentrated area than there will be moving into it from areas of lower concentration. This is not because the molecules have any preference, but because all molecules are in motion. Since there are more molecules in the highly concentrated area, there will be more molecules moving out than molecules coming in.
Osmosis restricts the normal process of diffusion by only allowing certain molecules (like the mice) to pass. Rather than a fence, the usual barrier is a “semi-permeable membrane” – basically a thin wall which has very small pores in it that allow only small molecules (like water) to pass, while blocking larger molecules. In this case, only the small molecules can diffuse across the barrier. Larger molecules have to stay on whichever side they are on. The effect of random movement will still be that the water (or other small molecules) will move across the barrier until equilibrium has been achieved. Under ideal circumstances, equilibrium means that the concentration is equal on both sides of the barrier. At this point water molecules are crossing the barrier in equal amounts, and no further change is observed.
It is often confusing to new students of chemistry that in osmosis water appears to move across the barrier towards the area of higher concentration. This is because they are used to thinking of the concentration of whatever chemical is dissolved in water. In the case of osmosis, it is the concentration of water that has to be considered, and the concentration of water is lower on the side of the barrier that has the greater concentration of other chemicals. If that is a little confusing, think of concentration in terms of a ratio. On the left side of a barrier, the mixture is ten parts water to one part sugar. On the right side, the mixture is one part water to one part sugar. The concentration of sugar is much higher on the right, but the concentration of water is higher on the left. Since the water is the only molecule small enough to cross the barrier, random motion causes it to have an overall flow towards the right until equilibrium is reached.
Osmosis is affected by other factors besides concentration. A common scenario occurs when two sides of a container are divided by a semi-permeable membrane. If the concentrations are unequal on the two sides, water flows accordingly to one side or the other to achieve an equilibrium concentration. With more water on one side or the other, the level of liquid is not equal on opposite sides of the barrier. As a result, the force of gravity contributes to the new equilibrium, pushing water molecules from the “taller” side back towards the shorter side. As a result, the two sides do not ever reach equal concentrations. Instead a balance is struck when the flow created by gravity is balanced by the flow created by random motion. The difference in height between the two sides of the barrier is used to define a term called “osmotic pressure”, referring to the force that would be required to support that amount of the solution against the pull of gravity.