A nightmare is a dream of particular intensity and with content that the sleeper finds disturbing. They are usually associated with rapid-eye movement (REM) periods of sleep, and may be accompanied by physical movements.

Up to about the eighteenth century, nightmares were often considered to be the work of demons, which were thought to sit on the chests of sleepers. Various forms of magic and spiritual possession were also advanced as causes. In nineteenth century Europe, the vagaries of diet were thought to be responsible. For example, a character in A Christmas Carol by Charles Dickens attributes the ghost he sees to "... an undigested bit of beef, a blot of mustard, a crumb of cheese, a fragment of an underdone potato..." In a similar vein, the Household Cyclopedia of 1881 offers the following advice about nightmares:

"Great attention is to be paid to regularity and choice of diet. Intemperance of every kind is hurtful, but nothing is more productive of this disease than drinking bad wine. Of eatables those which are most prejudicial are all fat and greasy meats and pastry... Moderate exercise contributes in a superior degree to promote the digestion of food and prevent flatulence; those, however, who are necessarily confined to a sedentary occupation, should particularly avoid applying themselves to study or bodily labor immediately after eating... Going to bed before the usual hour is a frequent cause of night-mare, as it either occasions the patient to sleep too long or to lie long awake in the night. Passing a whole night or part of a night without rest likewise gives birth to the disease, as it occasions the patient, on the succeeding night, to sleep too soundly. Indulging in sleep too late in the morning, is an almost certain method to bring on the paroxysm, and the more frequently it returns, the greater strength it acquires; the propensity to sleep at this time is almost irresistible."

In modern times, nightmares are thought to relate either to physiological causes, such as a high fever, or to psychological ones, such as unusual trauma or stress in the sleeper's life. The occasional body movements seen in nightmares may have a use in awakening the sleeper, thus helping to avoid the frighening dream-situation.