Doctors Note Logo

Published on: 7/14/2026

What causes legs to twitch when going to sleep?

Leg twitching when falling asleep is often caused by restless legs syndrome (RLS), periodic limb movement disorder (PLMD), or benign hypnic jerks. RLS triggers uncomfortable sensations and an urge to move the legs, while PLMD involves repetitive involuntary movements during sleep. Other common causes include stress, caffeine, magnesium deficiency, or certain medications.

Because these symptoms can point to several different conditions—some requiring treatment—it's important to understand what's driving your leg twitching before it disrupts your sleep long-term. Taking a free, instant, online symptom check can help you identify likely causes based on your specific symptoms and guide you on the right next steps, whether that's a lifestyle change or seeing a doctor.

Reviewed for medical accuracy: 07/14/2026

answer background

Explanation

When you are trying to sleep, sometimes your legs might twitch. This can happen because of a few reasons:

  1. Restless Legs Syndrome (RLS): This is a condition where you feel like you have to move your legs. It can make going to sleep hard because your legs feel uncomfortable.

  2. Periodic Limb Movements (PLM): These are movements that happen while you are asleep. They can make your legs twitch or jerk. Older people might have this happen more often.

  3. Alcohol Use: Drinking alcohol can make these leg movements happen more.

These movements might make it hard to get a good night's sleep. If you're experiencing these symptoms and want to understand what might be causing them, you can use a free symptom checker to help identify potential causes and determine if you should see a doctor.

(References)

  • Bliwise D, Petta D, Seidel W, & Dement W. (1985). Periodic leg movements during sleep in the elderly. Archives of gerontology and geriatrics, 4074025.

  • O'Regan D, & Anderson KN. (2020). Restless legs syndrome and periodic limb movements .... British journal of hospital medicine (London, England : 2005), 32003620.

  • Aldrich MS, & Shipley JE. (1993). Alcohol use and periodic limb movements of sleep. Alcoholism, clinical and experimental research, 8452202.

Thinking about asking ChatGPT?Ask me instead

Tell your friends about us.

We would love to help them too.

smily Shiba-inu looking

For First Time Users

What is Ubie’s Doctor’s Note?

We provide a database of explanations from real doctors on a range of medical topics. Get started by exploring our library of questions and topics you want to learn more about.

Was this page helpful?

Purpose and positioning of servicesUbie Doctor's Note is a service for informational purposes. The provision of information by physicians, medical professionals, etc. is not a medical treatment. If medical treatment is required, please consult your doctor or medical institution. We strive to provide reliable and accurate information, but we do not guarantee the completeness of the content. If you find any errors in the information, please contact us.