Heterocysts play an essential role in nitrogen-starved filamentous cyanobacteria. In environments with low concentrations of fixed nitrogen, individual cells in the filament of cyanobacteria can differentiate from a vegetative cell into a heterocyst.
This differentiation process involves the thickening of the cell wall to make it impermeable to oxygen, and expressing nitrogenase enzymes to enable the fixation process. Due to this, it is possible to identify heterocysts microscopically, as they appear larger and more spherical than their neighbours.
The nitrogen that is fixed by the heterocyst diffuses through special channel proteins in the cell wall, allowing the neighbouring cells to use it.