Swiss cheese has holes, also called "eyes," primarily because of carbon dioxide gas produced by a special bacterial culture called Propionibacteria (specifically Propionibacterium freudenreichii subspecies shermanii). These bacteria release carbon dioxide during fermentation, and the gas forms bubbles inside the cheese, creating the holes.
However, recent scientific findings reveal that tiny particles of hay in the milk play a critical role in the formation of these holes. Hay dust from dairy barns can weakens the curd structure, providing nucleation points for the gas bubbles and thus influencing the size and presence of the holes. This explains why modern Swiss cheese made with more sterile milking methods has fewer or smaller holes.
In summary, the holes in Swiss cheese are caused by a combination of bacterial carbon dioxide production and the presence of microscopic hay particles that create weak spots where the gas bubbles can form and expand.