Magnesium deficiency is known to cause muscle contractions, so it's possible that this could include eyelid twitching. Calcium, vitamin B12, and vitamin D deficiencies are often touted as potential triggers for eye twitching. However, this isn't supported by current research. A healthcare professional can test your levels of various vitamins and minerals to determine whether you're experiencing a deficiency. They can also recommend appropriate dietary changes, including potential supplements.