Fog begins to form when water vapor (a colorless gas) condenses into tiny liquid water droplets in the air. Conversely, water vapor is formed by the evaporation of liquid water or by the sublimation of ice. Since water vapor is colorless, it is actually the small liquid water droplets that are condensed from it that make water suspended in the atmosphere visible in the form of fog or any other type of cloud.
Fog normally occurs at a relative humidity near 100%. This can be achieved by either adding moisture to the air or dropping the ambient air temperature. Fog can form at lower humidities, and fog can sometimes not form with relative humidity at 100%. A reading of 100% relative humidity means that the air can hold no additional moisture and the air will then become supersaturated if additional moisture is added.
Fog formation does require all of the elements that normal cloud formation requires with the most important being condensation nuclei. When the air is saturated, additional moisture tends to condense rather than staying in the air as vapor. Condensation nuclei must be present in the form of dust, aeresols, pollutants, etc. for the water to condense upon. When there are exceptional amounts of condensation nuclei present, especially hydroscopic (water seeking such as salt, see below) then the water vapor may condense below 100% relative humidity.