Can the Keto Diet Cause Insomnia?

The ketogenic diet (commonly called the keto diet) is a high fat, moderate protein, low carbohydrate eating pattern. On a ketogenic diet, carbohydrates from all sources, such as whole grains, vegetables, and fruits, are severely restricted. This depletes the body of glucose, the body's main source of energy. When there is not enough glucose, the body breaks down fat into ketones for energy instead.

The ketogenic diet was originally developed and recommended as an evidence-based treatment for controlling epilepsy. More recently, the ketogenic diet has become popularized to manage weight loss, diabetes, and high cholesterol, among other conditions. However, the high-fat nature of the ketogenic diet is controversial, and its effects have not been fully studied.

A diet that is high in fat, especially saturated fats, is associated with short- and long-term risks, such as cardiovascular disease. It's important to note that the ketogenic diet differs from general, healthful eating patterns recommended by the USDA's Dietary Guidelines for Americans.

This article will discuss how diet and sleep are related, how the keto diet can trigger insomnia, and what to do about it.

Person checking their smartphone at bedtime

zoranm / Getty Images

The Connection Between Diet and Sleep

Increasingly, researchers are interested in the complex relationship between diet and sleep. A 2021 study associated consumption of healthier foods with better sleep quality while, inversely, an eating pattern with more highly-processed, sugar-rich foods was associated with lower sleep quality. This suggests that certain foods and eating patterns may improve sleep while others can make it difficult to fall asleep or to stay asleep.

What Causes Keto Insomnia?

A 2020 study about the relationship between diet and sleep linked high-carbohydrate diets, and foods containing tryptophan, melatonin, and phytonutrients to better sleep. Exactly how this occurs is unknown, but researchers believe that these foods support the production of serotonin and melatonin, important hormones that help regulate sleep. Therefore, it is possible that a diet low in carbohydrates can cause insomnia by disrupting these sleep-regulating chemicals.

Keto Flu Symptoms

Another cluster of symptoms often associated with starting the keto diet is "keto flu," or the general feeling of being unwell, similar to getting the flu. These symptoms may include headaches, fatigue, nausea, dizziness, "brain fog," gastrointestinal discomfort, decreased energy, faintness, and irregular heartbeat. These symptoms can last between days and weeks.

Electrolyte Imbalance

When you stop eating carbohydrates, the body will first use up glycogen for energy, or the stored glucose in the body. Since glycogen binds up water, as glycogen is depleted, the body will shed the excess water along with electrolytes like sodium, potassium, and magnesium. Your kidneys will excrete the water and electrolytes through urine which can cause an electrolyte imbalance.

Electrolytes are important for all cellular functions, so you may consider adding foods rich in potassium and magnesium like leafy greens, seeds, edamame, salmon, or avocado.

Carbohydrate Withdrawal

When you consume carbohydrates, they break down into glucose in the body. Glucose is the body and brain's preferred source of energy.

When your body begins to sense that you're low on glucose, several regulating mechanisms get triggered to tell you that you need more glucose. This can feel like intense cravings for carbohydrate-rich foods, especially sugary foods that quickly release more glucose into the bloodstream. The cravings for carbohydrates may also be coupled with feeling low on energy, sluggishness, and weakness until your body adjusts to using fat for fuel.

Digestive Issues

Many people who start the keto diet may experience digestive issues, such as diarrhea, constipation, bloating, gastric reflux, or abdominal discomfort. Additionally, cutting out or limiting grains, fruits, and vegetables may also negatively impact the gut microbiome (the natural collection of microorganisms that populate our intestines). This can further exacerbate gastrointestinal issues.

With any drastic changes to diet, there will be an adjustment period for the gut. This can take days or weeks.

Treatment and Prevention

Not everybody who tries a ketogenic diet will experience keto insomnia. However, there may be a few strategies to help manage symptoms and discomfort associated with the ketogenic diet.

Nutrient Intake

The ketogenic diet recommends consuming 75% of daily calories from fat, 20% of calories from protein, and 5% of calories from carbohydrates. Some people may find it difficult to meet their nutrient needs on the keto diet because of limited carbohydrate intake. Many people will cut out or severely limit grains, fruits, and vegetables. However, these are important sources of essential nutrients like fiber, vitamins, and minerals.

Adding a fiber supplement, choosing healthy, plant-based fats, and fiber-rich, non-starchy carbohydrates may help you meet your nutritional needs while on the keto diet.

Discuss the Keto Diet With Your Healthcare Provider

It's important to note that the ketogenic diet differs from the USDA recommendations for healthy eating, which recommends 45-65% of calories from carbohydrates and no more than 20-35% calories from fat, including limiting saturated fats to less than 10% of calories.

Always discuss significant diet changes with your healthcare provider before beginning, especially if you have a chronic medical condition.

Physical Activity

There are numerous benefits to regular physical activity, including better sleep. Research shows that any amount, intensity, and type of exercise is beneficial in improving sleep. Exercising during the day can help you fall asleep quicker at night, reduce stress and anxiety that may contribute to insomnia, and help increase sleep quality.

Relaxation Techniques

Find ways to relax and unwind with activities you find calming and enjoyable. This could be reading, listening to music, stretching, taking a shower, or adding a relaxation technique to your bedtime routine. These techniques prepare your body for sleep by lowering the heart rate, reducing tension in the body, and calming the mind. Some relaxation techniques include:

Proper Sleep Hygiene

Practicing good sleeping habits can help promote restful sleep. Best practices include:

  • Having a consistent routine for going to bed at night and waking each morning
  • Making sure your bedroom is quiet, dark, and relaxing
  • Removing electronic devices from your bedroom
  • Avoiding large meals, caffeine, and alcohol close to bedtime


The ketogenic diet is a popular and controversial diet that claims to have health benefits for a variety of conditions, including high cholesterol and diabetes. This diet is high in fat, moderate in protein, and very low in carbohydrates.

When switching to the keto diet, some people experience sleeplessness or insomnia due to the "keto flu," or general flu-like feelings of being unwell. Not all people who try keto will experience symptoms, such as gastrointestinal disturbances. However, there are a few strategies you can try to help alleviate the discomfort when switching to keto.

A Word From Verywell

The ketogenic diet is an evidence-based treatment for the management of neurological conditions, such as epilepsy. Other alleged health benefits of the ketogenic diet are controversial and largely result from short-term studies. Therefore, if you're considering the keto diet or any drastic change in how you eat, it's important to speak with your trusted healthcare provider, especially if you have underlying health conditions. You may want to consult with a registered dietitian nutritionist to ensure that you are eating safely and meeting your nutritional needs.

Frequently Asked Questions

  • What are the signs that you've entered ketosis?

    A common sign that you may be in ketosis is keto breath, or a slight fruity smell caused by exhaling acetone when your body is producing ketones. You can also test your ketone levels in your breath or urine using test strips or a breath analyzer, but these are not always reliable tests.

  • How long does keto insomnia last?

    The duration of keto insomnia depends on the person. Everybody responds different depending on their metabolism and how well their body can adapt to the change in nutrient intake.

  • Does the keto diet change your bathroom habits?

    A keto diet is low in carbohydrates such as grains, fruits, and vegetables. These foods contain important nutrients such as fiber, starch, and water that help with regulating bowel movements. Therefore, diets low in fiber can lead to constipation, or infrequent bowel movements or stools that are hard and difficult to pass.

7 Sources
Verywell Health uses only high-quality sources, including peer-reviewed studies, to support the facts within our articles. Read our editorial process to learn more about how we fact-check and keep our content accurate, reliable, and trustworthy.
  1. United States Department of Agriculture (USDA). Dietary Guidelines for Americans 2020-2025.

  2. Godos J, Grosso G, Castellano S, Galvano F, Caraci F, Ferri R. Association between diet and sleep quality: a systematic reviewSleep Medicine Reviews. 2021;57:101430. doi:10.1016/j.smrv.2021.101430

  3. Binks H, E. Vincent G, Gupta C, Irwin C, Khalesi S. Effects of diet on sleep: a narrative reviewNutrients. 2020;12(4):936. doi:10.3390/nu12040936

  4. Bostock ECS, Kirkby KC, Taylor BV, Hawrelak JA. Consumer reports of “keto flu” associated with the ketogenic dietFront Nutr. 2020;0. doi:10.3389/fnut.2020.00020

  5. Tuck CJ, Staudacher HM. The keto diet and the gut: cause for concern? The Lancet Gastroenterology and Hepatology. 2019;4:908-909.

  6. Kredlow MA, Capozzoli MC, Hearon BA, Calkins AW, Otto MW. The effects of physical activity on sleep: a meta-analytic reviewJ Behav Med. 2015;38(3):427-449. doi:10.1007/s10865-015-9617-6

  7. Centers for Disease Control and Prevention. Tips for better sleep.

By Rebecca Valdez, MS, RDN
Rebecca Valdez is a registered dietitian nutritionist and nutrition communications consultant, passionate about food justice, equity, and sustainability.