Sleepwalking happens when part of the brain wakes up while the rest stays deeply asleep, creating a hybrid state where the body can move and navigate but conscious awareness remains offline. This split occurs during the deepest stage of non-REM sleep, and it results from a combination of genetic predisposition, brain development, and a surprisingly long list of triggers ranging from poor sleep to certain medications. The mechanism is more nuanced than the classic image of someone wandering zombie-like through a hallway, and understanding it explains why some people grow out of it while others deal with episodes well into adulthood.
A Brain That Is Half Awake and Half Asleep
Normal sleep involves coordinated transitions between stages. Your whole brain moves together from light sleep into deep slow-wave sleep and then into REM sleep in roughly 90-minute cycles. In sleepwalkers, that coordination breaks down. During the deepest phase of non-REM sleep, certain brain regions abruptly shift toward wakefulness while others stay locked in slow-wave activity. The motor cortex and parts of the emotional brain activate enough to produce complex movement, but the prefrontal cortex, the seat of planning, judgment, and self-awareness, stays asleep. The result is a person who can walk, open doors, and even hold a mumbled conversation but has no conscious control and usually no memory of the event afterward.
Brain imaging research has pinpointed some of the specific regions that fire up just before an episode begins. One study using high-density EEG found that sleepwalking episodes were preceded by a burst of fast-frequency brain activity in the cingulate motor area, a region involved in planning and initiating movement. The activation appeared in the high beta range, between 24 and 30 Hz, in the seconds before the person got up and started walking.1Clinical Neurophysiology. Sleepwalking episodes are preceded by arousal-related activation in the cingulate motor area: EEG current density imaging This is consistent with the idea that motor circuits are waking up independently while the rest of the cortex stays offline.
This dissociation between motor control and conscious awareness has been confirmed in waking sleepwalkers as well. A study using virtual reality found that sleepwalkers showed elevated beta power in the brain during moments when their walking path was subtly redirected without their noticing it, a pattern not seen in controls. In other words, sleepwalkers’ brains handled the motor adjustment automatically while the conscious mind remained unaware of it.2Cortex. Dissociation of motor control from motor awareness in awake sleepwalkers: An EEG study in virtual reality Sleepwalkers seem to have a brain that is unusually good at separating action from awareness, and this trait persists even when they are fully awake.
The underlying instability in the brain’s sleep architecture also shows up on standard overnight sleep recordings. Sleepwalkers tend to show unusual slow-wave patterns, including bursts of high-amplitude delta waves that mark an unstable transition between deep sleep and partial arousal.3Sleep Medicine. Sleepwalking, a disorder of NREM sleep instability Their brains are not simply entering deep sleep and staying there; they are oscillating, and those oscillations occasionally tip into episodes.
Why Children Sleepwalk Far More Than Adults
Sleepwalking peaks in childhood and fades for the majority of people by the time they reach their teenage years. Roughly four out of five childhood sleepwalkers stop having episodes during adolescence.4Current Biology. Sleepwalking The reason is tied to brain maturation. Children spend more of their sleep time in deep slow-wave sleep compared to adults, and their arousal patterns differ: they produce more of the slow EEG activity that is associated with incomplete awakenings. As the brain matures, the balance between deep sleep and lighter stages shifts, and the arousal threshold becomes more stable. Fewer deep-sleep episodes mean fewer opportunities for that half-awake motor activation to occur.
The minority of people who continue sleepwalking into adulthood tend to have a stronger genetic loading and more identifiable triggers. For them, the underlying vulnerability in sleep-stage transitions never fully resolves, and environmental factors keep pulling the trigger on episodes.
The Genetic Piece
Sleepwalking runs in families, and research has begun to identify where in the genome the vulnerability might sit. A study of a large extended family in which sleepwalking followed an autosomal dominant inheritance pattern identified a region on chromosome 20 (specifically 20q12 to q13.12) that was strongly linked to the condition.5PubMed Central. Novel genetic findings in an extended family pedigree with sleepwalking The inheritance pattern had reduced penetrance, meaning not everyone who carried the relevant gene variant actually sleepwalked, but the genetic signal was clear. If one of your parents sleepwalked, your odds of doing so go up substantially. If both did, the odds climb further. The trait is not dictated by a single gene in most cases, but the family clustering is strong enough that researchers treat it as one of the most heritable sleep disorders.
Sleep Deprivation as the Most Reliable Trigger
Of all the things that can set off an episode, not getting enough sleep is the best studied and the most consistent. The mechanism is straightforward: when you are sleep-deprived, your brain compensates by plunging into unusually deep slow-wave sleep during the first few hours of recovery. That deeper-than-normal slow-wave sleep intensifies the conditions under which partial arousals can occur.6Journal of Sleep Medicine. A Case of Re-Emergent Sleepwalking in Adulthood, Primed by Sleep Deprivation and Triggered by Sleep Apnea
Researchers have tested this in the lab. In one experiment, sleepwalkers were kept awake for 25 hours and then allowed to fall asleep while researchers introduced gentle auditory stimuli designed to provoke partial arousals. During recovery sleep after deprivation, every single sleepwalker in the study had at least one induced episode, compared to only about a third who experienced episodes during normal sleep under the same provocation.7PubMed. Precipitating factors of somnambulism: impact of sleep deprivation and forced arousals The combination of deeper slow-wave sleep and a small external nudge was a near-guaranteed recipe for sleepwalking. This finding explains why episodes often cluster during stressful periods, travel across time zones, shift-work schedules, or any situation where sleep gets cut short and the brain’s rebound response kicks in.
Medications That Can Set Off Episodes
A systematic review identified 29 different medications linked to sleepwalking, falling mainly into four drug classes: benzodiazepine receptor agonists and related sleep aids, antidepressants that affect serotonin, antipsychotics, and beta-blockers.8PubMed. Medication induced sleepwalking: A systematic review The strongest evidence pointed to zolpidem and sodium oxybate, both of which act on the brain’s GABA system, the same network involved in regulating transitions between sleep stages.
Zolpidem, one of the most widely prescribed sleep medications in the world, has been particularly well documented. Case reports describe people starting to walk, eat, and even drive while asleep within weeks of beginning the drug.9PubMed Central. Zolpidem-induced sleepwalking, sleep related eating disorder, and sleep-driving: fluorine-18-flourodeoxyglucose positron emission tomography analysis, and a literature review of other unexpected clinical effects of zolpidem A systematic literature review found that the most common complex sleep behaviors associated with zolpidem were sleepwalking and sleep-related eating.10PubMed Central. Zolpidem for Insomnia: A Double-Edged Sword. A Systematic Literature Review on Zolpidem-Induced Complex Sleep Behaviors The irony is hard to miss: a drug prescribed to improve sleep can create one of the most dramatic sleep disorders. People with a personal or family history of sleepwalking are at higher risk, and many clinicians now screen for that history before prescribing.
Antidepressants that increase serotonin levels can also trigger episodes, as can lithium, certain anticonvulsants, and some over-the-counter antihistamines that cause sedation. The common thread among all these drugs is that they alter the brain’s normal cycling between sleep stages, making the boundary between deep sleep and wakefulness more permeable.
Sleep Apnea and Breathing-Related Triggers
Obstructive sleep apnea, a condition in which the airway repeatedly collapses during sleep, is one of the most underappreciated triggers for sleepwalking. Each time the airway closes, blood oxygen drops, and the brain responds with a micro-arousal to restore breathing. In someone with the underlying predisposition, those frequent micro-arousals during deep sleep are exactly the kind of partial awakening that can cascade into a full sleepwalking episode.11PubMed. Arousal reactions in sleepwalking and night terrors in adults: the role of respiratory events
Research suggests that the oxygen drops themselves play a key role. When oxygen levels fall sharply, the brain produces a cortical arousal that wakes certain regions while others lag behind, creating the mixed state of sleep and waking that defines sleepwalking.12Journal of Sleep Medicine. A Case of Successful Treatment of Sleepwalking Caused by Sleep Apnea Through Continuous Positive Airway Pressure Treating the apnea with continuous positive airway pressure (CPAP) has resolved sleepwalking in documented cases, confirming that the breathing disruption was the proximate cause. For adults who develop sleepwalking for the first time, or whose childhood sleepwalking returns after years of quiescence, screening for sleep apnea is one of the most important clinical steps.
Other Common Triggers
Beyond sleep deprivation, medications, and apnea, several other factors are known to provoke episodes in people who are predisposed:
- Fever: Elevated body temperature, particularly in children, can destabilize sleep architecture and increase deep slow-wave sleep, creating conditions ripe for partial arousals.
- Alcohol: Drinking before bed fragments sleep and increases slow-wave sleep in the first half of the night, both of which raise the probability of an episode.
- Stress and anxiety: Chronic stress disrupts sleep quality and can increase the frequency and depth of slow-wave sleep as the brain tries to compensate for fragmented rest.
- Environmental noise: Sudden sounds during deep sleep can produce the kind of incomplete arousal that tips into sleepwalking, which is why the lab studies mentioned above used auditory stimuli to reliably induce episodes.
- Full bladder: The physical discomfort of needing to urinate can produce a partial arousal during deep sleep, sometimes sending the person walking toward the bathroom or elsewhere without conscious awareness.
Most episodes result from the collision of two or more triggers at once. A genetically predisposed person who is sleep-deprived, has a glass of wine, and sleeps in an unfamiliar noisy hotel room has stacked several risk factors on top of each other.
How Dangerous Sleepwalking Can Be
Sleepwalking is often treated as harmless or even comedic in popular culture, but the reality for frequent sleepwalkers can be quite different. A clinical study of adult sleepwalkers found that over half reported dangerous behavior during episodes.13PubMed. The course and character of sleepwalking in adulthood: a clinical and polysomnographic study People have walked into traffic, fallen down stairs, attempted to cook, and handled sharp objects while asleep. The absence of conscious judgment means there is no risk assessment during these behaviors. The person’s motor system can execute complex sequences of actions, but the frontal lobe circuitry that would normally say “this is a bad idea” is asleep.
A related condition called sleep-related eating disorder illustrates how elaborate these episodes can become. People with this parasomnia get up during deep sleep, go to the kitchen, and eat, often consuming unusual combinations of food or even inedible items, then return to bed with little or no memory of the event.14PubMed. Treatment of sleep-related eating disorder The episodes can lead to weight gain, injuries from cooking while asleep, and ingestion of toxic substances.15PubMed. Sleep-Related Eating Disorder Sleep-related eating disorder commonly occurs alongside sleepwalking, restless legs syndrome, or medication use, particularly zolpidem.
Treatment Approaches
Treatment starts with addressing whatever triggers are identifiable. If a medication is the likely cause, switching to an alternative often resolves the problem. If sleep apnea is driving the arousals, treating the apnea with CPAP can eliminate episodes entirely. Improving sleep hygiene, maintaining a consistent schedule, avoiding alcohol close to bedtime, and managing stress all reduce the frequency of episodes by reducing the conditions that generate deep rebound slow-wave sleep.
For children, a technique called scheduled awakenings has proven effective. Parents track the timing of their child’s typical episodes and then gently wake the child about 15 to 30 minutes beforehand. A small study found that this approach immediately eliminated sleepwalking in all three children who tried it, and the benefits held at follow-ups three and six months later.16PubMed. The use of scheduled awakenings to eliminate childhood sleepwalking The logic is that the brief awakening interrupts the deep-sleep cycle before it reaches the instability point that would trigger an episode, essentially resetting the brain’s sleep architecture at the critical moment.
When behavioral strategies are not enough, medication becomes an option. Benzodiazepines are the most commonly prescribed drugs for persistent sleepwalking, with clonazepam used as first-line treatment in many sleep centers.17PubMed Central. Successful Treatment of Somnambulism With OROS-Methylphenidate A large retrospective study of 512 patients with non-REM parasomnias found that benzodiazepines were the most frequently prescribed class, used in about 47% of cases, followed by antidepressants, z-drugs, and melatonin.18PubMed Central. NREM parasomnias: a treatment approach based upon a retrospective case series of 512 patients Long-term treatment data show that nightly benzodiazepine use can achieve complete or substantial control in roughly 86% of adults with injurious parasomnias, with relatively stable dosing over years and low rates of significant dose escalation.19PubMed. Long-term, nightly benzodiazepine treatment of injurious parasomnias and other disorders of disrupted nocturnal sleep in 170 adults Still, benzodiazepines carry their own risks, including dependence and daytime sedation, so they tend to be reserved for cases where the episodes are frequent or dangerous.
Sleepwalking in the Courtroom
Because sleepwalkers have no conscious control and typically no memory of their actions, sleepwalking has occasionally been raised as a legal defense in criminal cases. The forensic challenge is substantial: how do you prove, after the fact, that someone was genuinely asleep during an act of violence or other criminal behavior? Sleep recordings taken after the alleged event can support the claim by showing the characteristic EEG patterns of a sleepwalker, and at least one defendant has been acquitted of all charges based partly on this kind of evidence.20PubMed Central. Defending sleepwalkers with science and an illustrative case
A systematic review of medical-legal cases involving sleep-related violence and sexual behavior during sleep found that forensic evaluations varied dramatically from case to case, with no consistent standard for how sleepwalking defenses are assessed.21PubMed Central. Sleep-related violence and sexual behavior in sleep: a systematic review of medical-legal case reports The legal system still struggles with these cases in part because the science itself is probabilistic. You can show that someone has the brain patterns of a chronic sleepwalker and that they were exposed to known triggers on the night in question, but you cannot definitively prove they were sleepwalking at a specific moment in the past. The cases remain among the most contentious intersections of neuroscience and law.
An Evolutionary Remnant?
One of the more intriguing questions about sleepwalking is why the capacity for it exists at all. Some researchers have speculated that it may be a leftover from an earlier era of human evolution, when the ability to mobilize rapidly during sleep could have been a survival advantage. The idea draws on the concept of unihemispheric sleep, in which certain animals keep half the brain awake while the other half sleeps, remaining alert to predators. Humans do not truly sleep with one hemisphere at a time, but sleepwalking could represent a crude version of this, where motor regions stay at a lower arousal threshold during deep sleep, ready to produce movement in response to an external threat.4Current Biology. Sleepwalking
A more elaborate version of this hypothesis proposes that under conditions of high predation risk or group uncertainty, certain individuals in ancestral human groups may have developed a partial dissociative sleep state that kept them in motor readiness.22OSF Preprints. An evolutionary-emotional perspective of insomnia and parasomnias The idea is speculative and hard to test, but it fits with what we know about the brain mechanics: the motor and emotional circuits that activate during sleepwalking are exactly the ones you would want online in a threat response. Whether this actually provided a survival benefit or is simply an accident of how sleep-stage transitions are wired remains an open question, but it reframes sleepwalking from a pure malfunction into something that might have once served a purpose, even if it is mostly a nuisance today.
How Sleepwalking Was Understood Before Neuroscience
The cultural meaning of sleepwalking has shifted dramatically over the centuries. In eighteenth-century Britain, sleepwalking transformed from a straightforward physical curiosity into a fashionable nervous disorder that fascinated philosophers and poets alike. It became central to debates about consciousness, personal identity, and the imagination, particularly during the rise of Romanticism and the cult of sensibility.23Journal for Eighteenth-Century Studies. Sleepwalking, Subjectivity and the Nervous Body in Eighteenth‐Century Britain Thinkers of the period were captivated by the paradox that still defines the condition: how can a person perform purposeful actions without being conscious? The question that once fueled drawing-room debates now drives functional neuroimaging studies, but the core mystery has not changed much. We understand the brain mechanics far better than we did 250 years ago, and yet the experience of a person navigating the world without any awareness that they are doing so remains one of the stranger phenomena in human biology.