Nitrogen is an essential and major component of biomass. While virtually all life depends on combined forms of nitrogen that are usually limited in availability, some prokaryotes, including many groups of cyanobacteria, can use the ubiquitous atmospheric dinitrogen (N2). As photoautotrophic bacteria they can easily meet the energy demand that is required by nitrogenase, the enzyme that reduces N2 to NH3. However, nitrogenase is very sensitive to oxygen and the oxygenic cyanobacteria have evolved various strategies to cope with this paradox. Primary production in the ocean is generally considered to be limited by nitrogen. In recent years it has become clear that N2-fixing cyanobacteria are important in the nitrogen budget of the surface oceans. Estimates of N2 fixation indicate that approximately half of global N2 fixation occurs in the sea. N2 fixation is not distributed homogenously throughout the oceans. Pelagic diazotrophic cyanobacteria are only found in (sub)tropical oceans and are notably absent in temperate and colder seas. However, at lower salinities in estuaries and other brackish environments, N2-fixing cyanobacteria can be abundant. N2-fixing cyanobacteria are also abundant in benthic mats in coastal and aquatic environments all over the globe, including polar regions. This demonstrates that N2-fixing cyanobacteria are not excluded from temperate and cold marine environments, even though they are only found in the water column of warm oceans. In this chapter we will discuss these aspects and review the existing knowledge of the diversity of N2-fixing cyanobacteria and the factors that determine their global distribution