Before diving, people apply spit or commercial defog solution to the inside of their masks to keep them from fogging. But why does it work? A client asked me this recently, and my answer was, "I have no idea, good question!" I imagine a majority of divers do not know the answer either.
To understand why spit keeps a mask from fogging, it is important to know why a mask fogs up in the first place.
All air contains some humidity, or miniscule particles of water. Once a mask is on a diver's face, he generally exhales some air into it through his nose. His breath adds more moisture to the air inside the mask.
The humidity inside a mask will condense into microscopic drops which fog the inside surface of the glass. The same process happens when a person pours a cold drink into a drinking glass. Droplets form on the outside of the drinking glass. These drops are condensed moisture from the air. The more humid and the warmer the surrounding air is, the more drops form. The same process happens on the inside of a mask's glass when warm air touches the cold glass and creates a fog of tiny water droplets.
The fog's tiny water droplets form because of the chemical ability of the water's molecules to hold themselves tightly together (called surface tension). This is a bit of a stretch, but think of a bunch of water molecules all holding hands in a small ring. That is your small water droplet or little particle of fog. Many of these make up the fog on the inside of a mask.
Spit (and other defogging agents) makes it hard for water molecules to "hold hands" and form the fog particle. Spit forces its way between the water molecules and makes them lose their grip on each other, causing them to spread out. (A chemical agent that works this way is called a surfactant.)
When a mask has been spit in, water can only form large, spread-out droplets because of the reduced surface tension. The large droplets are comparable in size to raindrops and do not stick to the mask in a fog. Instead, they roll to the bottom of the mask, leaving the glass clear. This is why after a dive, divers can find a small amount of water in the bottom of their masks (provided they didn't clear the masks during a dive). Masks will fog more in humid environments or when a diver breathes into the mask.
Still, some people just don't like spitting in their masks. Does spitting in a mask gross you out? Here are 8 Ways to Keep a Scuba Diving Mask From Fogging