Sugars are often used as stabilizers of protein formulations during freeze-drying. However, not all sugars are equally suitable for this purpose. Using in-line near-infrared spectroscopy during freeze-drying, it is shown here that hydrogen bond formation during freeze-drying, under secondary drying conditions in particular, can be related to the preservation of the functionality and structure of proteins during storage. The disaccharide trehalose was best capable of forming hydrogen bonds with the model protein, lactate dehydrogenase, thereby stabilizing it, followed by the molecularly flexible oligosaccharide inulin 4kDa. The molecularly rigid oligo- and polysaccharides dextran 5kDa and 70kDa, respectively, formed the least amount of hydrogen bonds and provided least stabilization of the protein. It is concluded that smaller and molecularly more flexible sugars are less affected by steric hindrance, allowing them to form more hydrogen bonds with the protein, thereby stabilizing it better.