The scrotum is an external bag of skin and muscle which contains the testicles. It is an extension of the abdomen, and is located between the penis and anus. The female homologue during fetal development is the outer labia.
The function of the scrotum is to keep the testicles at a temperature slightly lower than that of the rest of the body. For the human, a temperature around 34.4 degrees Celsius (94 degrees Fahrenheit) appears to be ideal; 36.7 degrees Celsius (98 degree Fahrenheit) may be damaging to sperm count. The temperature is controlled by making the scrotum tighter or looser, hence moving the testicles closer to the abdomen when it is cold, and away when hot, through the cremasteric reflex: the gradual tightening and loosening of the cremaster muscle in the abdomen and the dartos fascia (muscular tissue under the skin) in the scrotum.
Although the ideal temperature for sperm growth varies between species, it usually appears, in warm-blooded species, to be a bit cooler than internal body temperature, necessitating the scrotum. Since this leaves them vulnerable in many species, there is some debate on the evolutionary advantage of such a system. One theory is that making sperm highly sensitive to elevated body temperature prevents impregnation of females who are ill. Furthermore, some enzymes in sperm are denatured at higher temperatures and thus render them incapable of fertilising a female ovum.
In humans and some other mammals the base of the scrotum becomes covered with pubic hair at puberty.