When I first got certified I asked my instructor why my mask always fogged up. She told me it was because of the heat from my body causing condensation on the mask lens. She told me if I spit on the mask, it would prevent the condensation from forming. I sort of shrugged, and spit, and didn't really question that logic. Then about eight years later a buddy of mine pulled out a tube of Colgate and started smearing it on his lens. I asked him what he was doing, and he said the toothpaste polishes the lens, and that doesn't give the fog any nooks and crannies to grab into (he then rinsed his mask in the camera dunk tank, which was okay since there were no cameras on our boat that day). I tried this out, and it worked better than the spit. A couple years after this incident, a different diver pulled out a little shampoo bottle filled with something and started smearing this on his lens. Yet again I asked what was up, and he said it was Palmolive dish soap, but why it worked he just didn't know. This finally motivated me to find out what the heck was up with all these things divers use to prevent fog, and why they worked. So here's what I found...
For starters, it turns out my instructor was right about the condensation thing. The air we use to equalize our masks is heated by our bodies. Physics says that warm air can hold more moisture than cold air, so this air is also moist (the air picks up moisture from our lungs, and mouth, as well as any moisture that is in the tank.) The lens, unfortunately, is relatively cold (at least 15F cooler than our bodies even in warm water). So when this warm, moist air comes in contact with the cool glass of our masks, the air is cooled, and can no longer hold as much moisture. The water vapor then condenses on our masks as water.
This still didn't make sense to me. If we are looking through a thousand of gallons of water in front of our mask, what difference does one drop make inside our mask? That's where surface tension comes in. Water has an extremely high surface tension caused by the strong hydrogen bond, coupled with the relatively small weight of a water molecule. This makes the water molecules attempt to stick together very tightly in the smallest volume possible. In short, it means water will form beads on a surface instead of forming an even sheet. So the condensation forms millions of tiny water beads on the mask interior, which refract incoming light at random angles and obscures our vision. The more numerous and larger the beads, the worse our vision is obscured. This is fog.
There are two ways to prevent fog. We can either prevent condensation, or we can try to reduce the surface tension of the water that is condensing on our lenses. In order to prevent the condensation from forming, we would have to either: 1. Lower the temperature of our body to that of the surrounding water, 2. Lower the moisture content of our bodys so the air we exhale is completely dry, or 3. Add a dessicant to our masks. The first two involve hypothermia, and dehydration. The third would only work without the presence of water, so lets consider ways to reduce the surface tension of the water instead.
Fortunately, we have many ways to alter the surface tension of water. Soap is a great way to reduce surface tension. Ammonia will reduce it even more. And grease will repel water and increase the surface tension. Since ammonia would probably make a person blind if you put it on their masks, lets look at grease and soap. A thin layer of soap applied to the inside of a mask would mix with any water condensing onto the mask lens. The soap molecules are long with opposing polarities on either end, so they cause the water molecules to spread out, and produce a lower surface tension. This means the water will form a more even layer on your mask, which will be close to transparent.
Now lets see what happens when you coat the lens with grease. Oil repels water, which is why we can never clean a greasy frying pan using only water. So a tiny water droplet landing on a greased lens will bead more than a drop landing on a cleaned surface. This is because the natural surface tension of water is aided by the oil...not only is the water wanting to cling together, but the oil is also pushing the water together and causing fog.
Obviously, this means you don't want any grease on your lens, but mask manufacturers use a silicone grease in the production process to facilitate getting the masks out of the mask molds. This leaves a thin layer of silicone grease coating your mask when you buy it. In order to remove this, you need to scrub it off. An abrasive such as toothpaste does a great job of this. Soft scrub also works. Apply a gritty PASTE (not gel) to all parts of the mask, and scrub with a toothbrush, or a finger. Make sure you get all the nooks and crannies, and concentrate on the inside of the lens. Grease is also naturally accumulated from your skin, the water you dive in, and also from the mask skirt, which is made of silicone, and contains oils of its own. To prevent this buildup, repeat the scrubbing every so often to keep the mask clean. This also has the bonus effect of washing away any bacterial growth.
So, ideally, you want a mask free from any oil, and covered with a thin coat of some soapy substance. The soap on the inside of the lens should not irritate your eyes, and should also be rather transparent itself. Use a mild soap like Dawn, or Baby Shampoo to prevent irritation. To get a thin, even layer, either apply a diluted mix to the lens, and leave it there to dry, or smear a thick coat over the lens, and rinse off only the excess (I like storing my cleaner in a small eyedrop bottle and leaving it in my mask box). Don't rinse the mask so much you wash away all the soap, or you've lost your protection. Frequently flooding your mask also washes away this protective layer, so try to get a mask that doesn't leak.
There is so much anxiety caused by loss or impairment of vision underwater, that a fogged mask is not only an inconvenience, it can prove dangerous. You will have more trouble keeping track of your buddy, you will waste time flooding and clearing your mask, and you will be more prone to panic if something else goes wrong. Taking the time to address mask fogging makes diving safer, more relaxed, and more enjoyable.