Lifestyle
Keto and sleep: the rough start, and why it usually gets better
In the first week on keto many people sleep badly, and short sleep gets in the way of keto itself: a pull toward food, a scale that stands still. What happens at the start, why sleep often improves later, and how salt, magnesium, and a schedule fit in.
"I could not fall asleep, so I decided keto was not for me"
Veronika wrote to me on day five of keto. Dinner had been a light one, and the phone was put away ahead of time, but in bed, instead of sleep, she had the feeling of having drunk three cups of coffee before bed. She tossed until 1 a.m. Toward morning her calf cramped, and that finished the night.
"Maria, I thought keto would calm me down, and it did the opposite. Apparently this is not for me."
I asked her not to rush that conclusion. I asked about water, about salt, and about magnesium. She had not touched electrolytes at all, because nobody had told her that this matters from the first day. We went through the plan. A week later she was sleeping the way she had slept before keto. A month later she was sleeping better than before keto. Let us look at what happens to sleep at the start, and why it is early to worry.
Sleep and keto run like a two-way street
Both directions matter, not only one. Sleep changes how keto goes. And keto, in the first weeks, changes how you sleep. I will take them in order. Without both, the picture does not hold together.
How short sleep gets in the way of keto
One bad night is not a tragedy. Several nights in a row start a chain that is easy to follow. Short sleep raises morning cortisol, and the liver is more willing to let glucose out into the blood, even when you have eaten nothing. At the same time ghrelin rises, the hunger hormone, and leptin falls, the fullness hormone.
In practice it feels simple. You wake hungrier than usual, and you reach for what is fast and sweet, not for protein and not for fat. After a bad night the brain looks for the easiest fuel, not the most useful one.
In stretches like that, the weight can stand still on food that is formally in order. I went through this mechanism in the piece on a weight plateau. Sleep and stress sit there side by side, quiet saboteurs of the result. I will not repeat the whole account. The point to keep is this: short sleep can already cover over the effect of an ideal way of eating, and the scale is where that shows.
How the first weeks of keto change sleep
The other side is talked about less. In some people, during the first one to two weeks, sleep really does get worse. Falling asleep is hard. The dreams are vivid. There are wakings in the night. Sometimes the legs cramp.
You know the feeling of lying there and realizing the brain is too alert for the dark outside the window. That is this. What sits under it is not "keto is harmful." What sits under it is three specific mechanisms.
Three reasons the sleep jumps early
The electrolytes are rearranging. When insulin falls on keto, the kidneys clear more sodium, and water, potassium, and magnesium leave with it. Magnesium takes a direct part in the work of the nervous system, and a shortage of it gets in the way of the brain switching into rest. A shortage of sodium and of magnesium is also a common reason for night cramps in the legs, the cramps that wake you at 3 a.m. I went through the mechanism of those losses in the piece on keto flu, and in the piece on electrolytes and training. Here I am keeping only the part that concerns sleep.
Cortisol takes part in the adaptation. Moving to a new fuel is a light stress for the body, even in a calm person who usually sleeps well. At the start of keto, cortisol can sit a little higher than usual. Cortisol is also what gets in the way of sleep when it rises toward evening, instead of in the morning, which is where it belongs.
The evening brings more energy than you expected. Fat as a fuel burns more steadily than glucose, with no sharp drops. In some people that feels like a surge of alertness in the evening, at an hour that is a strange one for sleep. The body is not used to this even supply of energy yet, and for a while it mixes evening up with daytime.
Energy used to arrive in short bursts, like an old battery running down. Now the body is moving over to an outlet with a steady current. The outlet is stronger, and it is steadier, and the nervous system spends a couple of weeks getting used to the new voltage.
- Days 1–3: sleep barely changes
The electrolytes are only beginning to rearrange, and acute symptoms are usually not there yet. For some people it is already a little harder to fall asleep.
- Days 4–10: the peak of the wobble
The most likely stretch for hard falling-asleep, for waking in the night, and for cramps in the legs. This is the stretch where Veronika wrote to me in a panic.
- Weeks 2–3: a clear improvement
The electrolyte plan is already having an effect, and cortisol is leveling out. Falling asleep gets easier for almost everyone.
- After 3–8 weeks: sleep is often better than it was before keto
Blood sugar holds steady, with no sharp swings, and the night wakings from hunger go away. Many people sleep more deeply than they slept before keto.
After that, it almost always gets better
This is the good news, and it is the reason I am writing this. In most people, once primary adaptation is behind them, sleep does not merely come back. It becomes better than it was before keto.
The reason is simple, and it is a pleasant one. On a carbohydrate way of eating, blood sugar jumps up and down through the day, and through the night. A sharp drop in sugar toward morning is a common reason for that waking at 4 a.m., with the thought "I will go and have a snack." In ketosis the sugar holds level, the ketones give a steady background of energy, and for many people the hungry wakings in the night simply stop.
A month later, Veronika wrote to me on her own. "I did not know a person could sleep the whole night without waking once." She did not believe it at first. She decided it was a coincidence. She has slept that way into a third month.
What to do: bringing sleep back on keto
- Magnesium at night. The form, glycinate, malate, or another, is one you match to yourself. This is one of the most reliable steps there is, specifically for sleep.
- Enough salt through the day. A shortfall of sodium in the daytime comes back at night as cramps and as restless sleep. Salt your food more generously than you are used to, and drink broth.
- Do not train hard late in the evening. A heavy session close to the night raises cortisol at a poor hour, and it keeps the body from cooling down before sleep.
- Dinner not jammed against bedtime. Leave at least a couple of hours between the food and the bed, so digestion is not competing with sleep for what the body has to give.
- Screens and light, an hour before sleep. Bright light from the phone holds the brain in waking mode. Darkness is the signal for melatonin.
- Caffeine, no later than lunch. Caffeine can keep the nervous system stirred for 8–10 hours after the cup, even when you seem to fall asleep in the ordinary way.
- The same hours on weekdays and on weekends. A sharp move in when you get up, saved for the weekend, throws the inner clock about as hard as a flight into another time zone.
Two things that belong to keto, and are worth knowing ahead
If a leg cramps in the night, or you wake with a clear sense of thirst and of wanting salt, drink a little salty water right there in bed. Do not wait for morning. It takes the sharp symptom down quickly, and it lets you fall asleep again.
The second thing matters most for someone at the beginning. If hunger, the physical kind, is what keeps you from falling asleep in the first weeks, a small snack of fat and protein in the evening is not a failure, and it is not a break in the plan. A piece of cheese, or a couple of spoonfuls of 4% small-curd cottage cheese, is better than an hour of lying awake from hunger. Later, once the body has adapted to fat as fuel, most people find that the snack is no longer needed. It leaves on its own.
Alcohol takes sleep as well
A separate word on a glass in the evening, because the question comes up often. Alcohol helps you fall asleep sooner, and it takes the deep stages of sleep in the second half of the night. You wake having rested by the clock, and not restored in fact. On keto that effect can feel stronger, because alcohol is already a poor neighbor to the electrolyte balance.
Sleep on keto: the problem, the likely cause, what to do
| Problem | Likely cause | What to do |
|---|---|---|
| Hard to fall asleep in the first days | Cortisol during adaptation, and too much energy in the evening | A calm evening routine, workouts no later than the daytime, magnesium at night |
| Cramps in the legs at night | A shortage of sodium and of magnesium | Salt through the day, magnesium in the evening, salty water if a cramp is acute |
| Waking in the middle of the night | Electrolytes out of balance, and sometimes hunger at the start | Electrolytes, as in the plan above; a small snack in the first weeks if the waking is hunger |
| Vivid dreams, and sleep that stays light | The nervous system rearranging at the start | Usually passes on its own in 1–3 weeks, and needs nothing extra |
| Sleepy in the daytime, with a normal number of hours | Fat adaptation not far enough along, and not enough salt | More salt, more water, time, and patience |
When this is no longer adaptation
Everything above is about the temporary, explainable rough patch of the first weeks. Some signs are past the point where magnesium and a schedule are enough.
The short version
- Sleep and keto are tied in both directions. Short sleep raises cortisol and ghrelin, strengthens the pull toward food, and can hold the weight where it is.
- In the first one to two weeks, sleep gets worse for some people. Electrolytes are rearranging, cortisol is a little higher, and the evening brings an unfamiliar surge of energy.
- After primary adaptation, sleep is better than it used to be for most people, because blood sugar holds steady and the hungry wakings at night go away.
- Magnesium at night, and enough salt through the day, are the base for heading off cramps and restless sleep.
- A small evening snack of fat and protein, in the first weeks, is not a failure when hunger is what keeps you awake.
- Short sleep that lasts for weeks, apnea, and insomnia that stays are a reason to see a clinician, not a reason to wait it out.
Veronika looks back at that first week and smiles. "I was one step from dropping the whole thing, over a couple of sleepless nights." Salt and magnesium are a habit for her now, and the sleep is what she is prouder of than the number on the scale.
This is education, not medical care. Ketones are a fuel the liver makes from fat. If you are pregnant, nursing, have diabetes, kidney or liver disease, an eating disorder, or you give this food pattern to a child, talk with your clinician before you change how you eat.