Cyanobacteria are one of the oldest photosynthetic nitrogen fixers of the terrestrial as well as aquatic ecosystems. Cyanobacteria and microalgae produce a large number of secondary metabolites having biomedical, industrial, and biotechnological importance. Due to their presence in vast habitats, cyanobacteria and microalgae were exposed to variety of harsh environmental factors such as salt, desiccation, temperature, heavy metals, and ultraviolet radiation (UVR). In response, cyanobacteria have developed different mechanisms to cope these harsh environmental conditions. Photosynthetic nature of cyanobacteria continuously exposes them to lethal doses of UVR coming with solar radiation which affects their physiology, photosynthetic efficiency, productivity by reactive oxygen species (ROS) generation inside the cell and ultimately leads to cell death. In response to these stresses cyanobacteria have developed different protective mechanisms such as avoidance, enzymatic and non-enzymatic defence system and synthesis of novel secondary metabolites such as mycosporine-like amino acids (MAAs) and scytonemin. MAAs are water-soluble molecules that absorb short wavelength of solar UVR which release the energy in the form of heat. Scytonemin is a small hydrophobic alkaloid pigment present in the extracellular sheath of some cyanobacteria that acts as UVR protectant. Scytonemin and MAAs are highly photostable therefore, they primarily function as UV-screening compounds. They also show antioxidative properties. The capability of cyanobacteria to produce large number of secondary metabolites which serve as natural sunscreens, antibiotic, antifungal, anticancer and antiviral agents make them economically important organisms. These are readily biotechnologically exploitable in the cosmetics and other industrial sectors for the creation of novel medications and drugs. Hence, bioprospection of these photoprotective compounds and other secondary metabolites from cyanobacteria and microalgae becomes crucial. © The Editor(s) (if applicable) and The Author(s), under exclusive license to Springer Nature Singapore Pte Ltd. 2023.