The invention relates to a method for obtaining a magnesium fluoride (MgF2) sol solution, comprising the steps of providing a magnesium alkoxide precursor in a non-aqueous solvent and adding 1.85 to 2.05 molar equivalents of non-aqueous hydrofluoric acid to said magnesium precursor, characterized in that the reaction proceeds in the presence of carbon dioxide. The invention further relates to sol solutions, method of applying the sol solutions of the invention to surfaces as a coating, and to antireflective coatings obtained thereby.