Cyanobacteria are a very large and diverse phylum of photosynthetic prokaryotes. They are defined by their unique combination of pigments and their ability to perform oxygenic photosynthesis. They often live in colonial aggregates that can take on a multitude of forms. Of particular interest are the filamentous species, which often dominate the upper layers of microbial mats found in extreme environments such as hot springs, hypersaline water, deserts and the polar regions, but are also widely distributed in more mundane environments as well. They are evolutionarily optimized for environmental conditions of low oxygen. Some species are nitrogen-fixing and live in a wide variety of moist soils and water, either freely or in a symbiotic relationship with plants or lichen-forming fungi (as in the lichen genus Peltigera). 
Cyanobacteria are globally widespread photosynthetic prokaryotes and are major contributors to global biogeochemical cycles. They are the only oxygenic photosynthetic prokaryotes, and prosper in diverse and extreme habitats. They are among the oldest organisms on Earth with fossil records dating back at least 2.1 billion years. Since then, cyanobacteria have been essential players in the Earth's ecosystems. Planktonic cyanobacteria are a fundamental component of marine food webs and are major contributors to global carbon and nitrogen fluxes. Some cyanobacteria form harmful algal blooms causing the disruption of aquatic ecosystem services and intoxication of wildlife and humans by the production of powerful toxins (cyanotoxins) such as microcystins, saxitoxin, and cylindrospermopsin. Nowadays, cyanobacterial blooms pose a serious threat to aquatic environments and public health, and are increasing in frequency and magnitude globally.
Cyanobacteria are ubiquitous in marine environments and play important roles as primary producers. They are part of the marine phytoplankton, which currently contributes almost half of the Earth's total primary production. About 25% of the global marine primary production is contributed by cyanobacteria.
Within the cyanobacteria, only a few lineages colonized the open ocean: Crocosphaera and relatives, cyanobacterium UCYN-A, Trichodesmium, as well as Prochlorococcus and Synechococcus. From these lineages, nitrogen-fixing cyanobacteria are particularly important because they exert a control on primary productivity and the export of organic carbon to the deep ocean, by converting nitrogen gas into ammonium, which is later used to make amino acids and proteins. Marine picocyanobacteria (Prochlorococcus and Synechococcus) numerically dominate most phytoplankton assemblages in modern oceans, contributing importantly to primary productivity. While some planktonic cyanobacteria are unicellular and free living cells (e.g., Crocosphaera, Prochlorococcus, Synechococcus); others have established symbiotic relationships with haptophyte algae, such as coccolithophores. Amongst the filamentous forms, Trichodesmium are free-living and form aggregates. However, filamentous heterocyst-forming cyanobacteria (e.g., Richelia, Calothrix) are found in association with diatoms such as Hemiaulus, Rhizosolenia and Chaetoceros.
Marine cyanobacteria include the smallest known photosynthetic organisms. The smallest of all, Prochlorococcus, is just 0.5 to 0.8 micrometres across. In terms of numbers of individuals, Prochlorococcus is possibly the most plentiful genus on Earth: a single millilitre of surface seawater can contain 100,000 cells of this genus or more. Worldwide there are estimated to be several octillion (10, a billion billion billion) individuals. Prochlorococcus is ubiquitous between latitudes 40°N and 40°S, and dominates in the oligotrophic (nutrient-poor) regions of the oceans. The bacterium accounts for about 20% of the oxygen in the Earth's atmosphere.