The pineal gland (also known as the pineal body or epiphysis cerebri) is a small endocrine gland in the brain of most vertebrates. It produces melatonin, a serotonin-derived hormone, which modulates sleep patterns following the diurnal cycles. The shape of the gland resembles a pine cone, which gives it its name. The pineal gland is located in the epithalamus, near the center of the brain, between the two hemispheres, tucked in a groove where the two halves of the thalamus join. It is one of the neuroendocrine secretory circumventricular organs in which capillaries are mostly permeable to solutes in the blood.
The pineal gland is present in almost all vertebrates, but is absent in protochordates, in which there is a simple pineal homologue. The hagfish, archaic vertebrates, lack a pineal gland. In some species of amphibians and reptiles, the gland is linked to a light-sensing organ, variously called the parietal eye, the pineal eye or the third eye. Reconstruction of the biological evolution pattern suggests that the pineal gland was originally a kind of atrophied photoreceptor that developed into a neuroendocrine organ.