Two weeks into keto and I can't sleep. Lying awake for 2-3 hours, mind racing, body feels "wired" even when I'm tired. This is making everything harder and I'm not sure I can continue if it doesn't improve. Is this a keto thing?
Keto insomnia — can't sleep since starting this diet
5 Replies
Yes, this is a documented keto side effect in the early weeks, and it resolves for most people. Here's why it happens:
1. Cortisol: Your body treats the sudden loss of carbohydrates as a potential stress event. Cortisol rises to mobilize stored energy — which is helpful for fat burning but keeps your brain alert at night.
2. Electrolytes: Specifically magnesium deficiency. Magnesium is directly involved in the neurological mechanisms that enable sleep onset and sleep quality. Keto depletes it rapidly.
3. Blood sugar patterns: Your brain is adapting to running on ketones. During adaptation it may generate cortisol spikes overnight to maintain glucose supply to areas that haven't fully switched yet.
Fixes that work: Magnesium glycinate 400mg 30-60 minutes before bed (most important). Small protein snack before bed if very early in keto — some people find this stabilizes nighttime energy. Light exercise during the day (not evening). Keep consistent sleep schedule.
The magnesium glycinate before bed is legitimately effective — within 3-4 nights most people report improved sleep quality. It's one of the most evidence-supported sleep interventions that exists regardless of keto, and keto depletion of magnesium makes it even more critical.
Also: reduce caffeine. Many keto beginners increase their coffee intake (it's the one reliable comfort food allowed) without realizing caffeine metabolizes slower when your liver is busy with ketone production. Your 2pm coffee might be affecting sleep more than it did before keto. Try cutting off caffeine at noon for 2 weeks.
The caffeine point is very relevant for me — I definitely increased my coffee on keto. Taking magnesium glycinate tonight and moving last coffee to noon. Will report in a week.
I had this for 10 days then it completely resolved and my sleep became the best it's been in years. Fully fat adapted, magnesium sorted — keto sleep is genuinely great once you're through the adaptation. Hang in there.