Leg cramps while hiking (and doing any other strenuous activity) are usually caused by one of two main factors: lack of potassium, and dehydration. A lack of potassium causes your Some potassium heavy food: Bananas (400 mg per 100 grams of food) Yogurt (531 mg per 8 oz) Dried Apricots (1380 mg per 100 grams of food) Nuts (600 mg per 100 grams of food) Figs (900 mg per 100 grams of food) Raisins (1020 mg per 100 grams of food) Dried Fruit (880 mg per 100 grams of food) Baked Potato (600 mg per 100 grams of food) Beans (700-1300 mg per cup of food) For a longer list of potassium rich foods: http://PotassiumRichFoods.com/potassium-rich-foods-list/ On average, you need 3,500 mg of potassium per day. 18,000 mg of potassium per day is considered too much. Keeping your potassium level up days before hiking will help prevent cramps. You should also take potassium rich foods right after a hike to prevent cramping in the evening. Dehydration, too, is a big problem causing the pain. While dehydration aggravates the condition, salt depletion is said to be the real culprit. Voluntary skeletal muscle bundles sometimes fire involuntarily and powerfully when salt is depleted, causing the intense pain you feel. When I was suffering from leg cramps, I started increasing my electrolyte intake during the hike (Gatorade) and in the days leading up to the hike (eating bananas for potassium), coupled with conditioning and good hydration and I haven't suffered from cramps in awhile, much to the dismay of my companions who are no longer entertained by my on-trail antics. Still, there is no answer for everyone, because our bodies, diets and habits are all different! Conditioning, hydration and diet all play a part for me, and I also avoid alcohol and diet sodas leading up to the hiking day, especially when warmer temps or long hikes are coming up as both effect my levels of hydration and electrolytes.