Eating before you exercise may sometimes not be necessary. Whether or not you need a pre-workout meal depends on when you last ate, and whether or not you ate enough protein. If it has been several hours since you last ate, eating some fast-digesting protein (for example, whey) an hour or so before you hit the gym will help to increase muscle protein synthesis, and consuming some carbohydrate with that protein will give you the energy you need for an effective workout. The pre-workout carbohydrate will also help you to maintain blood sugar levels, delay the fatigue of your muscles, improve your endurance, and spare the glycogen in your muscle tissues. This is important because when muscle glycogen levels are low, exercise-induced muscle breakdown can be accelerated. High-glycemic carbohydrates are best for short (one-hour), high-intensity workouts, whereas low-glycemic carbohydrates are preferred for long (two-hour or more) endurance workouts.
It is well known that consuming a protein-rich meal after a workout can improve your muscle-building results. It does this by minimizing post-workout muscle protein breakdown and maximizing protein synthesis. One study suggests that 20 grams of easy-to-digest protein is the optimal amount for muscle growth immediately after exercise. When athletes consumed less than 20 grams, they gained less muscle; when they consumed more than 25 grams, they experienced no further muscle gains. Note, however, that the athletes weighed around 85 kilograms (187 pounds). If you weigh significantly more than this, you will need a bit more protein, and if you weigh significantly less, you will need a bit less protein.
For best results, the post-workout meal should also include carbohydrate, with the amount of carbohydrate usually recommended being one gram per kilogram of body weight (0.45 grams per pound of body weight). The reason that carbohydrate should be consumed with the protein is that it promotes a greater release of insulin, which facilitates the transport of glucose and amino acids into muscle cells. The more insulin there is available, the more glucose and amino acids can be carried into muscles for protein synthesis. Insulin also reduces the stress hormone cortisol, which is known to suppress protein synthesis, stimulate protein breakdown, and even affect testosterone production.
Another reason to eat carbohydrate after a workout is to replenish muscle glycogen stores. As explained above, maintaining muscle glycogen stores reduces the need for muscle protein breakdown.