Maybe it depends on technical cause of what seems to be cramps. And maybe it helps indirectly by helping some other process in the body. But in ny experience there’s direct correlation between magnesium intake and cramps and nail health.
I’ve a feeling genetics may be involved since my kid also has similar tendencies. And doctor we went to for his night cramps did suggest magnesium which worked. So whether there’s research or not, doctors do suggest it and it does seem to help at least in some cases.
If you're experiencing muscle cramps due to low magnesium then adding a supplement will almost certainly fix the problem.
If you're experiencing muscle cramps for another reason, it won't work, probably.
But supplements are cheap and low risk, so it's a good thing to try first.
A more accurate statement would be "there is no scientific proof that Mg works against cramps [absent a Mg deficiency]."
However, potassium and calcium are a lot more prevalent in standard diets so it's usually lack of magnesium that is the culprit.
Source: I can reproduce this on demand.
Running for a year now, it doesn't seem to make a difference.
But if your lived experience says it works, it doesn't really need to have scientific evidence.
The real question is if there is evidence that relevant doesea of magnesium supplements are harmful, and if so, how those harms compare to the cramps you're experiencing.
There's all sorts of unscientific stuff out there, some of which is harmful. But if it's not harmful, it's worth trying.
If you get frequent cramps and you don't want to try magnesium supplements, you could try going out of your way to eat more foods that are known to be high in magnesium, most of which are generally considered healthy and there you go; choosing to eat a bit more leafy greens doesn't feel risky unless you've got an alergy. Having a banana to get potasium should be fine for most too, unless the fruit sugar is a problem or if there's an allergy.
The non-blood test way would be to take magnesium until you get diarrhea and then take less but that is obviously not a pleasant experience.
I take magnesium because it is really obvious when I track micro nutrients that I don't get enough in my diet. It mostly depends though on how much spinach I am eating.
from https://pmc.ncbi.nlm.nih.gov/articles/PMC6316205/
Of clinical importance, around 0.3% of total body magnesium is found in serum. Thus, total and/or ionized magnesium concentrations measured in plasma or serum are not reliable markers of total magnesium levels in the body; as serum magnesium does not reflect the total magnesium content at the tissue or organs, and is also a poor indicator of intracellular magnesium content.
Emerging evidence suggests that the serum magnesium/calcium quotient (0.4 is optimal, 0.36–0.28 too low) is a more practical and sensitive indicator of magnesium status and/or turnover, than the serum magnesium level alone [19]. In chronic latent magnesium deficiency, magnesium levels in the blood are within a normal range, despite there being severely depleted magnesium content in the tissues and bones. Therefore, using magnesium levels in the blood to determine total magnesium levels in the body can result in underestimation of magnesium deficiency in healthy and diseased populations. Recent studies have shown that individuals with serum magnesium levels around 1.82 mg/dL (0.75 mmol/L) are most likely to have a magnesium deficiency, while those with serum magnesium level more than 2.07 mg/dL (0.85 mmol/L) are most likely to have adequate levels