In many filamentous cyanobacteria, oxygenic photosynthesis is restricted to vegetative cells, whereas N(2) fixation is confined to microoxic heterocysts. The heterocyst has an envelope that provides a barrier to gas exchange: N(2) and O(2) diffuse into heterocysts at similar rates, which ensures that concentrations of N(2) are high enough to saturate N(2) fixation while respiration maintains O(2) at concentrations low enough to prevent nitrogenase inactivation. I propose that the main gas-diffusion pathway is through the terminal pores that connect heterocysts with vegetative cells. Transmembrane proteins would make the narrow pores permeable enough and they might provide a means of regulating the rate of gas exchange, increasing it by day, when N(2) fixation is most active, and decreasing it at night, minimizing O(2) entry. Comparisons are made with stomata, which regulate gas exchange in plants.