When we think of food going stale, we typically think of products such as bread. You might think that bread starts to stale days after it is made. But the process of staling actually begins as soon as the loaf leaves the oven and begins to cool. How quickly bread goes stale depends on what ingredients are in it, how it was baked, and the storage conditions.
Breads are essentially networks of wheat flour protein (gluten) molecules and starch molecules. Suspended inside this scaffolding are pockets of carbon dioxide gas that are produced during fermentation by yeast. This creates a foamlike texture.
The most important event in the process of staling is when starch molecules crystallize. The starch molecules need water molecules to form their crystal structure. They get the water molecules from the gluten. As a result, the network changes, becoming rigid at room temperature and below. This state, however, is reversed with the introduction of heat; stale bread can be freshened by warming it—as in toasting.