Cyanobacteria are often the key organisms comprising microbial mats. They form dense micrometer-scale communities in which the full plethora of microbial metabolism can be present. Such mats are therefore excellent model systems and because of their analogy with Precambrian stromatolites they are also attractive subjects for evolutionary studies. Growth and metabolism of the oxygenic phototrophic cyanobacteria enrich the sediment with organic matter. However, in mature mats net growth of cyanobacteria appears to be of less importance. Most of the organic matter produced from photosynthetic CO2 fixation is liberated in the sediment by one of the following: fermentation, photorespiration, pouring out of solutes or secretion of mucus although grazing may also be important. This organic matter is degraded by chemotrophic microorganisms, among which sulphate-reducing bacteria are particularly prominent. The combined activities of the cyanobacteria and sulphate-reducing bacteria result in steep and fluctuating gradients of sulphide and oxygen. Cyanobacteria therefore have to cope with high concentrations of sulphide, oxygen supersaturated – and anoxic conditions. These physicochemical gradients force different functional groups of microorganisms to particular vertical stratified positions in the mat. This, and the fact that accretion of sediment fluctuates, gives rise to one of the most conspicuous properties of microbial mats namely their laminated structure. Modern microbial mats have this laminated structure in common with Precambrian stromatolites. Most modern mats do not lithify but this may also have been the case for Archean microbial mats. Only a few examples of modern calcifying stromatolithic microbial mats are known. A hypothesis has been developed which conceives a role for extracellular polysaccharides in calcification. Extracellular polysaccharides in cyanobacterial mats are often produced as the result of unbalanced growth caused by nitrogen deficiency. The mat organisms are embedded in the extensive polysaccharide matrix that inhibits calcification. All cyanobacterial mats can fix atmospheric dinitrogen, which covers part of their nitrogen demand, but the fluctuating physicochemical gradients limits the efficiency of this process.