Leg cramps are not listed as a common side effect of metformin in the US prescribing information. Still, metformin can contribute indirectly: its most common side effect, diarrhea, can leave you dehydrated and low on minerals, and long-term use can lower vitamin B12. Rarely, muscle pain or cramping is a warning sign of lactic acidosis, which is an emergency.
Get emergency care (call 911 or go to the ER) if muscle pain or cramping comes with any of these: fast, deep or shallow breathing, shortness of breath, unusual sleepiness or weakness, stomach pain, nausea or vomiting, dizziness, a slow or irregular heartbeat, or feeling cold in your hands and feet. On metformin, these can be signs of lactic acidosis.
What the Metformin Label Actually Says
In US prescribing information, diarrhea and nausea are among the most frequent side effects. The MedlinePlus metformin page also lists stomach discomfort, gas, indigestion, constipation, weakness, headache, a change in taste and muscle pain. Leg cramps as a distinct side effect do not appear, and published research on metformin causing cramps directly is very limited.
That does not mean your cramps are unrelated. It means the link, when there is one, usually runs through something else. Here are the main ways metformin can be involved:
| Possible link | How it could cause cramps | What helps |
|---|---|---|
| Diarrhea and dehydration | Loose stools drain water, sodium and potassium, and low fluid and minerals are a known cramp trigger | Fluids, taking metformin with meals, asking about the extended-release form |
| Low vitamin B12 | Long-term deficiency can damage nerves, causing numbness, tingling and leg discomfort | A B12 blood test and treatment if levels are low |
| Lactic acidosis (rare) | Lactic acid builds up and causes muscle pain along with breathing changes and sleepiness | Emergency care right away |
| Low blood sugar with other drugs | Metformin alone rarely causes lows, but adding insulin or a sulfonylurea can, and low blood sugar can cause shakiness and muscle weakness that is easy to confuse with cramps | Check your glucose and review your medicines with your doctor |
Diarrhea, Dehydration and Lost Minerals
Stomach upset is the side effect people notice most, especially in the first weeks or after a dose increase. According to MedlinePlus, common causes of muscle cramps include dehydration and low levels of minerals such as sodium, potassium or calcium. Ongoing diarrhea can cause both.
If your cramps started around the same time as loose stools, mention that link to your doctor. Taking metformin with meals, starting at a low dose and increasing slowly, and switching to an extended-release tablet are common ways to reduce stomach effects. Your prescriber decides which of these fits. Our guides to metformin diarrhea and electrolyte drinks and diabetes cover this in more detail.
Vitamin B12 and Your Nerves
Metformin can lower vitamin B12 over time. The label notes that B12 fell below normal in some people during clinical trials and recommends measuring it every two to three years. MedlinePlus lists long-term metformin use as a cause of B12 deficiency and explains that prolonged deficiency can cause numbness and tingling in the hands and feet from nerve damage.
B12 deficiency is not a classic cause of simple muscle cramps, but nerve symptoms in the legs can feel like cramping, burning or aching, especially at night. Because these symptoms overlap with diabetic neuropathy, a blood test is the only way to know. Learn what the vitamin B12 test involves and when to ask for one.
Lactic Acidosis: Rare but Serious
Metformin carries a boxed warning for lactic acidosis, a buildup of lactic acid in the blood. It is rare, but it can be fatal. The label describes early symptoms as vague: feeling unwell, muscle pain, breathing trouble, unusual sleepiness and stomach pain.
Risk is higher with:
- Kidney problems (metformin should not be used when eGFR is below 30)
- Age 65 or older
- Heavy alcohol use or binge drinking
- Liver problems
- Surgery, or imaging tests that use iodinated contrast dye
- Conditions that lower oxygen levels, such as a heart attack or sudden worsening of heart failure
A single cramp after a long walk is not lactic acidosis. The concern is muscle pain or cramping that comes with feeling very unwell, breathing changes or drowsiness. See our articles on metformin and alcohol and contrast dye and metformin for related precautions.
Other Common Causes of Leg Cramps
Many people on metformin also have diabetes or prediabetes, and leg cramps are common in that group for other reasons. According to MedlinePlus, causes of muscle cramps include:
- Overuse or strain, often during or after exercise
- Dehydration, including from high blood sugar that makes you urinate more
- Low sodium, potassium or calcium
- Alcohol use disorder
- An underactive thyroid (hypothyroidism)
- Kidney failure
- Certain medicines
- Pregnancy
Nerve damage from diabetes can also cause cramps, burning or aching in the legs and feet. Leg pain that comes on with walking and eases with rest is worth mentioning separately, because poor blood flow from peripheral artery disease is more common with diabetes. Read more in our guide to diabetes and leg cramps.
What You Can Do About Night Leg Cramps
For an ordinary cramp, MedlinePlus suggests:
- Stop the activity and gently stretch and massage the muscle
- Use heat when the spasm starts and ice once the pain eases
- Drink fluids, and replace minerals if you have been sweating or had diarrhea
- Stretch regularly and stay active within your ability
If you have kidney disease or take medicines that raise potassium, ask your care team before adding potassium-rich foods, salt substitutes or mineral supplements. The same applies to magnesium supplements. Our article on magnesium and blood sugar explains what the evidence does and does not show.
When to Talk to Your Doctor
Make an appointment if your cramps:
- Are severe, frequent or keep coming back
- Do not ease with stretching
- Come with numbness, tingling or burning in your feet
- Started after a new medicine or dose change
- Come with ongoing diarrhea, swelling, leg color changes or pain with walking
Your doctor may check your kidney function, electrolytes, thyroid and vitamin B12, and review all your medicines. Do not stop or change your metformin dose without talking to your prescriber first. You can find more on medication options on our treatment hub.
The Bottom Line
Metformin is not known to cause leg cramps directly, and cramps are not listed as a common side effect. It can still play a part through diarrhea and dehydration or, over the long term, low vitamin B12. Most cramps have simple causes, but muscle pain with breathing changes, drowsiness or stomach pain needs emergency care because it can signal lactic acidosis. For ordinary cramps, stretch, stay hydrated and ask your doctor whether a B12 or electrolyte check is due.