Fog forms when the temperature drops to the point where the air cannot hold all the moisture in it at that temperature. This at 100% relative humidity, which is called the dew point. Fog begins to form as air, which had previously been warmer and had moisture in it, cools until it reaches the dew point. Then we'll see tiny droplets of water forming in the air close to the ground, which is fog. A link can be found below.