Sunning or basking, sometimes also known as sunbathing, is a thermoregulatory or comfort behaviour used by humans, animals, especially birds, reptiles, and insects, to help raise their body temperature, reduce the energy needed for temperature maintenance or to provide comfort. They may also have additional functions of ridding animals of ectoparasites, bacteria, or excess moisture.

Birds 
Birds adopt special postures when sunning, these may include spreading out their feathers, flattening their body on soil, showing either their upper parts to the Sun or facing the Sun. Some authors separate the behaviours into sun-basking and sun-exposure - the former term used when the behaviour is strictly thermoregulatory in function while the latter term may be more appropriate if the behaviour serves functions other than raising body temperature.

In some species, the sunbathing posture is adopted in very hot weather and the birds sometimes stay in close contact with hot soil. Birds may fluff up their feathers, expose their preen-gland, lean to one side and so on. The wings may be turned inside out as in the boobies or held in delta-wing positions as in herons and storks or held outspread as by vultures. Swallows were observed to indulge in the activity for very short durations and this appeared to induce hyperthermia leading to them gaping to cool. Observers have suggested that the purpose might not be thermoregulation in these cases. A theory that birds obtained vitamin D by allowing precursors in the preen-gland secretions to be converted by ultraviolet radiation is considered to be unsupported. Large soaring birds such as Gyps vultures may use sun-bathing postures to help in stiffening their feathers as they used such postures only prior to flying and not during the early morning hours. Another theory is that ectoparasites may be killed or forced to move away from inaccessible parts of the body to more accessible areas where they can be removed through preening. This is supported by the observation that sunning is often followed by preening. Feather-degrading bacteria are known to be killed by the action of sunlight.

Reptiles and amphibians 
Basking is common to most active diurnal reptiles. Lizards, crocodiles, terrapins, and snakes routinely make use of the morning sun to raise their body temperature. Freshwater turtles and terrapins have been found to bask and raise their body temperature close to the highest temperatures that they can tolerate.

Mammals 

Some mammals and mostly humans make use of the sun to warm their body or to provide comfort. It has been suggested that early mammals, which may have been small and nocturnal, may have basked to rapidly warm their bodies based on observations made on a nocturnal marsupial, Pseudantechinus macdonnellensis.

Insects 

Many insects require the morning sun to come out of nocturnal torpor and become active. In the higher latitudes, many insects have black on their wings or body to enhance their heat acquisition. This trend for increased darkness in higher latitudes is especially well marked in the Lepidoptera although the trend may be more general and unrelated to thermoregulation as it is also seen in nocturnal Geometridae.

References 

Ethology