Ketogenic diet for migraine: a study (n=1)

16 February 2025

Tl;dr: the ketogenic diet helped (me) reduce drastically migraine intensity and frequency

A 1bit landscape.

It is almost midnight. I’m nearing the end of fixing a data migration issue, but I haven’t deployed the changes yet. Despite the late hour, I’m relieved the problem will finally be solved, and I try to ignore one more worry: that I might get a horribly debilitating migraine the next day.

I have struggled with migraines since at least middle school. I always had the impression that there was a kind of chemical imbalance in my brain. Recently, I found this paper showing that is indeed the case, and that imbalance is caused by the brain burning more energy than it can absorb: The metabolic face of migraine (pdf)

So the migraine is a ‘reset’ trigger that replenishes energy. At least that’s the hope; unfortunately, there are times when it fails, leading to an extended period of painful headaches followed by yet another migraine.

There is a factor that plays a big role with this: I have trouble falling asleep. Apart from some exceptional conditions, I cannot take naps, and I cannot really fall asleep one hour earlier than my usual schedule. Of course, I can easily fall asleep one hour later, which means that I can easily create a sleep deficit but then fail to repay it. Because of this, DST changes almost always result in a month of frequent headaches, as that is the time it takes for my body to adjust to the change.

The issue becomes unmanageable when I’m overworked, which causes weekly migraines. In these cases, I might spend 5 days working non-stop followed by 2 days bedridden, unable to do anything but recover from the pain.

The Ketogenic diet

What it is

The ketogenic diet is a radical change in how the metabolism gets energy. Instead of burning sugar (and carbohydrates, which are basically long sugar molecules), it aims to use ketones as fuel, which means using fat as fuel source. It was originally designed to help people with epilepsy, and it showed very good results.

The Therapeutic Role of Ketogenic Diet in Neurological Disorders

History of the ketogenic diet

The bad: Ketogenic diet traps

The main reason I didn’t consider the diet before is because of the scam peddlers of ‘external ketones’, MCT oils, or ‘keto snacks’. These highly processed foods are extremely expensive. My first encounter was with ‘Bulletproof Coffee’ being advertised on HN. This is the absolute worst of beyond parody hyper-capitalistic crap of hyper-processed food being sold on bad science.

While I don’t struggle with weight due to my body’s inability to store fat, the diet’s focus on weight loss was a turnoff for me. In fact, I made a conscious effort to maintain my weight after starting it.

The good

There is absolutely no need for any of that processed crap; the ketogenic diet can be followed on a purely natural basis. To do that, it is absolutely necessary to cook. It isn’t a problem for us because in the family we had spent almost 10 years with very little consumption of industrially processed food.

difficulties

There are 4 expected difficulties with the keto diet.

Budget:

It is certainly an issue if you want to continue eating local produce (living in a rich country) and/or organic (even if only for products that tend to be high in pesticide residues). While switching from a carb-heavy diet to keto isn’t as drastic as it might seem, the focus on quality ingredients means our grocery budget increased by 30%.

Social events:

Social gatherings can present a challenge. For example, the mozzarella you order at a restaurant might be coated in peach syrup, and the meat carpaccio could be served with high fructose corn syrup sauce. While it might be possible to request that sugars be omitted, many restaurants may not be aware of all the hidden sugars in their dishes, such as maize flour used as a thickening agent or coating. No solution is very good; I would think fasting instead is the best option, but that is not very social.

Sugar craving:

This one is highly dependent on the individual. Personally, I love the foundation of keto meals, but fries, ramen, and chocolate are hard to resist. Generally I prefer a keto meal over a standard meal, but seeing or smelling delicious fries can be very tempting. I also tend to crave chocolate when I work late, as I used to snack on it often. It is not too bad, but some moments need some willpower. Finding healthy alternatives, like delicious 100% cocoa chocolate helps, although it may be quite expensive.

Unintuitive carb contents:

Most nuts are keto, except for cashews. Vegetables are also a bit complicated to judge, and a lot of resources end up unclear as they may confuse the fiber content, set arbitrary ‘low-carb’ thresholds rather than providing explicit numbers, etc. So it is a bit of a challenge but definitely doable with the right resources.

Managing hunger

The curse of any diet is hunger. Hunger is distracting, it requires willpower to resist, and is in general making it difficult to concentrate on tasks at hand, leading to irritability and decreased productivity. It can derail even the most disciplined individuals.

The keto diet can help manage hunger through several mechanisms. It is high in fats, which take longer to digest and are more satiating than carbohydrates, helping you feel fuller for extended periods. It also includes a moderate intake of protein, which contributes to feelings of fullness. Additionally, the diet reduces the sugar spikes and crashes associated with high-carb diets, which often lead to increased hunger and cravings.

Resources

There are many resources I would actively discourage people from viewing, like typical ‘breakdown of a research paper’ articles that mostly engage in fearmongering, or anything that promotes highly-processed foods (MCT/snake oil, etc.).

The best resource for us has been ruled.me (despite the weight loss angle, but once again this is where most people will encounter it). It provides recipes, diet plans, all the explanations needed with handy graphs to help navigate keto-friendly vegetables or dairy products, distinguishing them from the ones that should be limited or avoided.

While eating lunch, we often watch some videos, and during our learning phase, we found the Berry and Berg YouTube channels to be valuable for filling in gaps and better integrating some of our knowledge. We looked a bit everywhere and 95% of what helped was in the three resources above. For recipes, a quick search will almost always provide the perfect result, offering alternatives for practically anything.

Why it works

Since migraines are caused by an inadequate supply of brain fuel, and the ketogenic diet proposes to use another fuel source for the brain, it might provide a solution to it. Because life was very painful, it was worth a try.

I will reference two key articles: one discussing the keto diet’s potential in treating Alzheimer’s disease, and another specifically focused on migraines.

If not provided with glucose, the brain (and muscles) rely on ketones for energy, which are produced from fatty acids. Not only it is an alternative fuel source, but it is also a cleaner form of energy. Burning ketones for energy produces less oxidative stress in cells compared to glucose metabolism, which is associated with various autoimmune diseases. This process generates fewer free radicals, allowing the body to better neutralize them with antioxidants that protect our cells. Since ketones cross the blood-brain barrier, all of this benefits neurons, enhancing brain cell function.

Research conducted about a decade ago revealed that high blood sugar levels could negatively impact cognitive function. More glucose is linked to worse outcomes, even in absentia of sugar-related pathologies such as diabetes. This is consistent with the fact that worse metabolism cause more damage in the long run. For further details, see See Glucose Levels and Risk of Dementia

As an evolutionary aside, glucose-based diet is very recent for the human species, as it’s only with agriculture, providing grain and fruits, that glucose changed from an extremely attractive rarity to the base food source. Humans spent about 200,000 years as hunter gatherers, and by all estimates less than 12,000 dependent on agriculture, which is very short on a biological timescale. For this reason, humans need a minimum of fat to survive, whereas they need only a tiny amount of glucose, which it can synthetise on its own by glucogenesis. It could be argued that a very-low carb diet is a return to the norm.

From an evolutionary perspective, a glucose-based diet is a relatively recent development for the human species. For approximately 200,000 years, humans lived as hunter-gatherers, and it is only in (at most) the past 12,000 years that they have relied on agriculture—a brief period on a biological timescale. It was only with the advent of agriculture, which provided grains and fruits, that glucose shifted from an extremely rare and attractive resource to a primary food source. As a consequence, humans require a minimum intake of dietary fat to survive, whereas the body can synthetize the tiny amount of glucose it needs through gluconeogenesis. Thus, one could argue that a very low-carb diet represents a return to our dietary roots.

Results of the ketogenic diet

Before fully committing to a ketogenic diet, I followed a low-carb diet for over a week, which was difficult to maintain due to constant hunger. After that, switching to a strict ketogenic diet—where I reduced my carb intake to a very low level—was much easier, and my hunger subsided after just two days.

I did not experience any symptoms of the keto flu, except for some tiredness, which actually helped me sleep well. After two weeks, however, I experienced a very bad migraine following a demanding 12-hour day of programming, which was certainly a very bad idea.

Aside from that, I had minor headaches that resolved fairly quickly—within a few hours, rather than a full day.

The change in diet has led to much better digestion. I often experienced a burning sensation in my stomach after eating a lot of carbs (such as pasta, rice, or bread), but this issue has been completely eliminated.

About a month after starting the diet, I fell ill with some gastro. It caused me to spend the first day vomiting all the broccoli, almond flour, and coconut oil I had eaten, and then I was unable to eat for three days. The smell and even the thought of these ingredients made me feel nauseous, and I feared I would never want to eat again. After this crisis was over, I ate other keto-friendly foods, avoiding these entirely, and I slowly got back into normal. However, the following week, I experienced frequent headaches and felt generally unwell. This made me want to give up, but since I wasn’t the one preparing the meals (my lovely SO did), I continued anyway.

Two weeks later, I didn’t notice any headache anymore, and I felt much better overall.

I’m unsure if the gastro was worsened by a reaction to keto adaptation or simply a bad virus. My aversion to rooibos tea around that time suggests it might have been coincidental.

After 3 weeks, these ingredients could be reintroduced into my diet without issue.

While coffee generally helps migraines, it can also be problematic due to its impact on blood flow and rebound effects. To manage my coffee addiction (a ‘Vietnamese curse’ from Trung N’Guyen), I limit myself to two cups daily: one at breakfast and one after lunch. If I experience a light headache, I may increase to three or four cups as it can alleviate the pain. Intriguingly, the keto diet amplifies caffeine’s stimulating effects, which I did not notice before, as I only drank coffee for the taste.

Despite maintaining the same lifestyle and the high stress from work, I now sleep better with less effort. So I wonder if the benefits can be attributed to the keto diet enabling my body to regulate its metabolism more efficiently, leading to better overall function, restful sleep, and fewer migraines. There is research suggesting sugar does worsen sleep quality, but it seems much harder to estimate how much of the effect is due to it.

Worth it?

One thing to note with migraines is that it is hard to evaluate what will cause them and when. Sometimes I work hard and expect at least a headache but that does not happen. Sometimes I have a very strong one but cannot find what might have triggered it. So it is hard to manage, and difficult to prevent in a work context (unless you can cancel a meeting because you feel you might have a migraine afterward). In other words, it tends to dominate your life. After the keto diet the situation is qualitatively the same, but the quantities have changed a lot. Without the weekly migraines that makes me think that life is just pain and misery, life is qualitatively better.

As I finished writing this, I had a fairly bad migraine, ironically. This happened after a flu, and it seems that in case of migraines tend to be worse after any kind of sickness. So it’s important to note that the effect is an important reduction in frequency and intensity, not a “cure”. Is it worth the higher budget and life constraints? I would say yes without a doubt, but the added benefits (better sleep and better digestion) make it a no-brainer for me.

Whipped cream, a keto treat.

P.S. I wrote this after 4 months, and we are now about 13 months in. Little has changed with regards to my observations, although I wouldn’t write them in a such a way; e.g., sugar craving is really a thing of the past. The only thing that changed was an increase in sugar-fueled social interactions, which gives a choice between some social discomfort or a bad next day.