Vitamin B12 is the deficiency most directly linked to eye twitching in the medical literature, because low B12 impairs the protective coating around nerves and can irritate the tiny nerves controlling your eyelid muscles. But B12 is not the whole story. Magnesium, calcium, and vitamin D have all been connected to involuntary eyelid movements, and the relationship between nutrients and that annoying flicker beside your eye is more tangled than a single vitamin answer suggests.
How B12 Deficiency Triggers Eyelid Twitching
Your body uses vitamin B12 to build and maintain myelin, the insulating sheath that wraps around nerve fibers. When B12 drops too low, myelin production slows down. The result is nerves that misfire more easily. This is why B12 deficiency is well known for causing tingling and numbness in the hands and feet, but the same mechanism can affect the small nerves that control your eyelid muscles, leading to involuntary twitches.1PubMed Central. Metformin-induced eyelid myokymia
The medical term for that common, low-grade eyelid flutter is myokymia. It is usually limited to one eye, lasts seconds to minutes, and feels far more dramatic than it looks. Most people around you cannot even see it happening. Myokymia is almost always benign, but when it becomes persistent or keeps returning, clinicians look at nutritional status as one possible contributor, with B12 near the top of the checklist.
People at higher risk of B12 deficiency include older adults whose stomachs produce less of the acid needed to absorb the vitamin, anyone following a strict vegan or vegetarian diet (since B12 occurs naturally only in animal products), and people taking certain medications. The diabetes drug metformin, for example, is known to lower B12 levels over time, and case reports have specifically tied metformin-induced B12 depletion to eyelid myokymia.1PubMed Central. Metformin-induced eyelid myokymia
Magnesium and Muscle Excitability
If you search “eye twitching” online, magnesium deficiency will come up almost as often as B12. There is a reason for that. Magnesium acts as a gatekeeper for nerve and muscle excitability. When your magnesium levels are low, nerve cells fire more readily, and muscles contract when they should not. The eyelid, being one of the thinnest and most active muscles in the body, tends to show the effects early.
Magnesium supplementation is one of the treatments studied for eyelid myokymia and related involuntary facial spasms. Research framing magnesium alongside stress reduction reflects how closely the two factors overlap: stress depletes magnesium, and low magnesium amplifies the body’s stress response, creating a feedback loop that makes twitching more likely to start and harder to stop.2Journal of Pharmaceutical Research and Integrated Medical Sciences. Eye spasm/Eye twitching: Mg Supplementation and Stress-Reduction in Treating Eyelid Myokymia, Psychosomatic of Anxiety: of Eye Twitching Among High-Stress, Hemifacial Spasm,Blepharospasm
Unlike B12 deficiency, which often requires blood work to identify, magnesium deficiency is tricky to measure because most of the body’s magnesium sits inside cells and bones, not in the bloodstream. A standard blood test can come back normal even when tissue stores are running low. This means you can be functionally low in magnesium while your lab numbers look fine, which partly explains why so many people report their twitching resolves after adding a magnesium supplement even though their doctor never flagged a deficiency.
Calcium and Vitamin D in Eyelid Spasms
Calcium plays a direct role in how muscles contract. Every time a nerve signals a muscle fiber to move, calcium floods into the cell to trigger the contraction. When serum calcium drops, the threshold for nerve activation decreases, meaning nerves fire more easily and muscles twitch on their own. A study comparing people with benign essential blepharospasm (a more persistent and severe form of eyelid twitching) against controls found that serum calcium was significantly lower in the blepharospasm group, even though both groups’ calcium levels technically stayed within the normal clinical range.3Graefe’s Archive for Clinical and Experimental Ophthalmology. Serum calcium, magnesium, phosphorus, and vitamin D in benign essential blepharospasm
That last detail matters: the difference was subtle enough that a routine blood panel might not flag it. Calcium levels in the blepharospasm patients averaged around 9.5 mg/dL compared to 9.9 mg/dL in controls. Both sit within the standard reference range of 9 to 10.5 mg/dL. This suggests that even mild reductions in calcium, well before anything looks alarming on paper, may be enough to tip sensitive eyelid nerves toward twitching.3Graefe’s Archive for Clinical and Experimental Ophthalmology. Serum calcium, magnesium, phosphorus, and vitamin D in benign essential blepharospasm
Vitamin D enters the picture because of its relationship with calcium absorption. Your body cannot efficiently pull calcium from food without adequate vitamin D. The same study found a moderate negative correlation between vitamin D levels and the severity of blepharospasm symptoms: the lower someone’s vitamin D, the worse their twitching tended to be.3Graefe’s Archive for Clinical and Experimental Ophthalmology. Serum calcium, magnesium, phosphorus, and vitamin D in benign essential blepharospasm So vitamin D deficiency may not cause eye twitching directly in the way B12 or magnesium deficiency does, but it can worsen the problem indirectly by dragging down calcium.
Stress, Sleep, and Screen Time Often Matter More
Here is the honest reality most nutrient-focused articles gloss over: for the vast majority of people experiencing occasional eye twitching, the cause is not a vitamin deficiency at all. It is lifestyle. Stress, poor sleep, too much caffeine, and prolonged screen use are the triggers that eye doctors encounter most often, and they tend to overlap. A person under deadline pressure is also the person sleeping five hours a night, drinking extra coffee, and staring at a monitor for twelve hours straight.
Research identifies chronic stress and dysfunction in the autonomic nervous system as playing an important role in neuromuscular hyperactivity and ocular muscle spasms. The connection is not just psychological. Stress hormones directly increase neural excitability and muscle tension, and the eyelid is one of the first places that shows up.2Journal of Pharmaceutical Research and Integrated Medical Sciences. Eye spasm/Eye twitching: Mg Supplementation and Stress-Reduction in Treating Eyelid Myokymia, Psychosomatic of Anxiety: of Eye Twitching Among High-Stress, Hemifacial Spasm,Blepharospasm
Dehydration is another factor that gets mentioned constantly in popular health articles. The picture here is a bit more nuanced than “drink more water and the twitching stops.” A systematic review of dehydration and neuromuscular function found that dehydration does not appear to affect the brain’s motor signals or the spinal circuits controlling muscles. Instead, dehydration’s effects occur at the peripheral level within the muscle itself.4Applied Physiology, Nutrition, and Metabolism. Does acute dehydration affect the neuromuscular function in healthy adults?-a systematic review That means dehydration might make a muscle twitch more easily once it is already irritable, but it is unlikely to be the primary cause of eyelid spasms on its own. It is more of an amplifier than a trigger.
Why Multiple Deficiencies Often Coexist
One thing that makes pinning down “the” vitamin deficiency behind eye twitching so difficult is that these nutrients do not operate independently. A person low in magnesium is often also low in vitamin D. Someone with low vitamin D will absorb calcium less efficiently. Someone eating a restricted diet may be short on B12 and magnesium simultaneously. And all of these people are more likely to also be stressed, under-sleeping, and over-caffeinated, because the same life circumstances that lead to poor nutrition tend to come bundled with poor sleep and high pressure.
This clustering effect is why “take magnesium” or “get your B12 checked” can both be good advice that works for different people: the underlying issue is not always the same single deficiency, and fixing any one bottleneck in a system under multiple pressures can be enough to quiet the twitching. It also explains why many people try one supplement, see no change, try another, and finally get relief. They were not wrong about the first one being involved; they just had more than one gap to fill.
When Eye Twitching Needs Medical Attention
Occasional eye twitching that lasts a few seconds or minutes and then disappears is almost never a sign of something serious. It is one of those annoying body glitches, like a hiccup, that happens and then goes away. But there are circumstances where you should see a doctor rather than reaching for a supplement bottle.
Persistent twitching that lasts more than a few weeks, twitching that involves both eyelids closing forcefully (rather than a subtle flutter), or twitching that spreads to other parts of your face all warrant a clinical evaluation. These patterns can indicate benign essential blepharospasm or hemifacial spasm, conditions that involve deeper neurological dysfunction beyond simple nutritional gaps. Benign essential blepharospasm affects both eyes and can progress to the point where people have difficulty keeping their eyes open, which is a very different situation from the single-lid flicker most people experience.
For those more serious conditions, treatment goes well beyond supplements. Botulinum toxin injections have been used in ophthalmology for decades to treat blepharospasm and related conditions by temporarily weakening the overactive muscles.5Survey of Ophthalmology. Therapeutic review Botulinum A toxin (Oculinum®) in ophthalmology The injections typically need to be repeated every few months, but they are effective for most people and have a long track record of safety in this specific application.
What to Actually Do About Nutritional Eye Twitching
If your twitching is the garden-variety kind, a single lid fluttering on and off for a few days, and you suspect a nutritional component, there is a practical order of operations worth following rather than blindly buying every supplement on the shelf.
Start with the basics that are hardest to overdo and easiest to fix. Get more sleep. Cut back on caffeine, especially after noon. Take breaks from screens using the 20-20-20 approach: every 20 minutes, look at something about 20 feet away for 20 seconds. These lifestyle adjustments resolve most episodes of myokymia on their own.
If twitching persists after a week or two of better habits, magnesium is a reasonable first supplement to try. Most adults do not get enough magnesium from food alone, and supplementation at moderate doses is safe for the vast majority of people. Magnesium glycinate and magnesium citrate are the forms most commonly recommended because they are better absorbed than magnesium oxide.
If you have risk factors for B12 deficiency, such as being over 50, following a plant-based diet, taking metformin, or having a digestive condition that impairs absorption, ask your doctor for a blood test. B12 deficiency is easy and inexpensive to test for and easy to correct with supplements or injections once identified. Unlike magnesium, where you might reasonably try supplementing without a test first, B12 is worth confirming because the symptoms of B12 deficiency can overlap with many other conditions, and the deficiency can cause lasting nerve damage if it goes untreated for too long.
Vitamin D is also worth testing if you live in a northern latitude, spend most of your time indoors, or have darker skin (which reduces vitamin D synthesis from sunlight). Given the evidence linking lower vitamin D to more severe eyelid spasms, correcting a deficiency is a sensible step even if it is unlikely to be the sole cause of your twitching.
Medications That Can Mimic or Cause Nutrient-Related Twitching
Sometimes the real culprit behind eye twitching is not your diet but your medicine cabinet. Several common medications can either directly trigger eyelid spasms or do so indirectly by depleting the very nutrients your nerves need.
Metformin, as mentioned earlier, is a well-documented example. It reduces B12 absorption in the gut, and people who take it for years without B12 monitoring can develop deficiency severe enough to cause neuropathy and eyelid twitching.1PubMed Central. Metformin-induced eyelid myokymia Certain antiepileptic drugs, proton pump inhibitors used for acid reflux, and some diuretics can deplete magnesium over time. Stimulant medications for ADHD increase neural excitability and can provoke twitching through a non-nutritional pathway entirely.
If you started or changed a medication around the time your eye twitching began, that timing is worth mentioning to your doctor. The fix might be adding a targeted supplement, adjusting the dose, or switching to an alternative medication rather than overhauling your entire diet.
The Difference Between Myokymia and Blepharospasm
People often use “eye twitching” to describe two very different conditions, and the distinction matters for understanding whether nutritional changes are likely to help.
Myokymia is the fine, rippling movement you can feel but others usually cannot see. It involves tiny contractions of the orbicularis oculi muscle, typically in just one eyelid. It comes and goes, rarely lasts more than a few days at a stretch, and responds well to rest, stress reduction, and nutritional correction. This is what most people mean when they say their eye is twitching.
Blepharospasm is a different animal. It involves both eyes, produces forceful, involuntary closure of the eyelids, and tends to worsen over time without treatment. People with benign essential blepharospasm may have difficulty reading, driving, or even walking because their eyes squeeze shut unpredictably. The condition appears to involve a malfunction in the brain’s basal ganglia rather than simple nerve irritability. Nutritional supplementation alone is unlikely to resolve blepharospasm, though the correlation between lower calcium and vitamin D levels and more severe symptoms suggests that nutritional status may still play a modifying role.3Graefe’s Archive for Clinical and Experimental Ophthalmology. Serum calcium, magnesium, phosphorus, and vitamin D in benign essential blepharospasm Treatment for blepharospasm typically involves botulinum toxin injections, and in severe cases, surgery to remove some of the overactive muscle tissue.5Survey of Ophthalmology. Therapeutic review Botulinum A toxin (Oculinum®) in ophthalmology
If your twitching affects both eyes, forces your eyes shut rather than just fluttering, or has been steadily getting worse over weeks, you are dealing with something beyond what a magnesium supplement will fix, and a neurologist or neuro-ophthalmologist is the right next step.