The only difference is visibility.
So, if the visibility is one kilometre or less it is fog. Although for driving the definition of fog is having visibility less than 100 metres. Otherwise, it is mist.
Formation wise, fog is basically cloud on the ground. It usually forms when the sky is clear and the wind speeds are low, often at appearing night and disappearing during the day. It commonly forms in dips near sources of moisture such as streams and rivers.
