If one is interested in using magnesium as a supplement the common advice is:
In general, for healthy adults the recommendation is between 310 and 420 mg per day. Males tend to need more than females, although females will need to increase intake during pregnancy and lactation.
Keep in mind that you likely already get some naturally – sources of magnesium include foods from your diet and/or from your multivitamin. Many multivitamins will contain around 100mg of magnesium, which is about ¼ of the recommended daily amount.
If one is interested in using magnesium as a medicine that one needs to think at much higher dosages, somewhere between one to three grams depending on one’s medical needs.