Regular physical activity
To relax the muscles and prevent cramping, avoid sitting or standing for prolonged periods of time and make sure you take a 10- to 30-minute walk on a daily basis.
Stretching
If you are experiencing a leg cramp, begin to stretch the muscle and gently rub the area.
Drink more water
To prevent dehydration, you need to drink enough water throughout the day.
Acupuncture or massage
Acupuncture and massage are known to have a soothing and relaxing effect on the muscles, which directly deals with the root of the problem.
Intake more magnesium
Magnesium is an important nutrient which has the power to prevent muscle spasms. You can get it from eating more seeds and nuts or by rubbing the legs with magnesium oil. You can also opt for quality magnesium supplements.
Epsom salt bath
Epsom salt baths can be of great aid for people who have this problem. The soaking will soothe the muscles and supply the body with magnesium.