The skin plays an important role in thermoregulation, i.e. maintaining normal body temperature. It does this by reacting differently to hot and cold conditions so that the inner body temperature remains more or less constant. Temperature sensors distributed over the skin respond nearly immediately to changes in the environment and provide the major input.
The numerous sweat glands under the skin secrete sweat, which is salt-laden moisture along with wastes, the evaporation of which may account, in certain circumstances, for as much as 90% of the cooling of the body; The sweat glands in the skin of mammals are one of the few purely thermoregulatory organs known.
The fat cells of skin act as insulation against cold.
In hot conditions, the hairs on the skin lie flat, preventing heat from being trapped by the layer of still air between the hairs. This is caused by tiny muscles under the surface of the skin called erector pili muscles relaxing so that their attached hair follicles are not erect. These flat hairs increase the flow of air next to the skin increasing heat loss by convection. Also vasodilation occurs during hot times. In this process, there is relaxation of smooth muscle in arteriole walls allowing increased blood flow through the artery. This redirects blood into the superficial capillaries in the skin increasing heat loss by convection and conduction.
During cold conditions, the erector pili muscles contract, lifting the hair follicle upright. This makes our hairs stand on end which acts as an insulating layer, trapping heat. Also, arterioles carrying blood to superficial capillaries under the surface of the skin constrict, thereby rerouting blood away from the skin and towards the warmer core of the body. This process called vasoconstriction prevents blood from losing heat to the surroundings.