Committing to a regular fitness routine is key to living a long, healthy life. Along with the obvious calorie burn and weight loss you can get from exercise, physical activity can also boost your energy levels, reduce your risk of some diseases, make your clothes fit better, improve your mood and even clear up your skin.

But before you even focus on your resistance level, speed or mileage, it’s important to make sure you’re loading up your body with the right nutrients before and after you break a sweat. That’s why it’s important to know what to eat before and after your workout.

You’ve probably heard that you’re supposed to eat carbohydrates before working out and protein after, but why? And how much do you really need? Turns out, it’s not just about the number of calories you’re fueling your body with, but also the types of calories and nutrients you’re choosing.

Pre-Workout Fuel-Up

“When you don’t fuel your body properly before, during and after exercise, it won’t be able to perform at its best, just like if you don’t put the right fuel in your car, it’s not going to run very efficiently or get very far,” says Sarah-Jane Bedwell, registered dietitian, consultant to CLIF and LUNA, and author of Schedule Me Skinny: Plan to Lose Weight and Keep it Off in Just 30 Minutes a Week. If you’re not fueling your body sufficiently pre-workout, you’ll likely feel fatigued faster and not be able to push yourself as hard. If you don’t refuel properly after, you could run into some other issues beyond just feeling sluggish. “You won’t see results as quickly, you may feel sore longer and you may be dehydrated,” she says.

To avoid letting your health and fitness level suffer, focus on the timing and quality of your pre- and post-workout meals.

Pre-Workout: Energize With Carbs:
“When fueling up for a workout, focus on carbohydrates,” says Bedwell. “Not only are they your body’s first source of energy, they are also easy to digest and less likely to upset your stomach during a workout than large amounts of protein or fat.” Aim to eat one or two hours before you plan to exercise to give your body some time to digest but also still have it available as fuel.

For easy to moderate workouts lasting less than one hour, consume 0.5 grams of carbohydrates per kilogram of body weight—that’s about 30 grams for a 140-pound woman. Bedwell suggests a medium-sized banana or a Luna bar. For a workout that will last over an hour, you should fuel up with 1 gram of carbohydrate per kilogram of body weight. Try a medium banana and a Luna bar, or 1 cup of oatmeal topped with a ¼ cup raisins. If you’re working out for a long time—say, you’re out for a long run while training for a marathon—you should also refuel throughout your workout.

Pre-workout, avoid eating anything that’s high in fat, fiber or protein. This includes full-fat dairy products, which you shouldn’t really be eating anyway, along with high-fiber cereals or bars or large quantities of meat or nuts. “Fat and protein take longer to digest than carbohydrates and fiber slows down digestion as well,” Bedwell notes, so eating too much of these nutrients before working out will prevent your body from breaking them down into fuel efficiently and quickly. You also might end up with a stomachache—definitely not ideal exercise conditions.

Bedwell also suggests consuming 16-24 ounces of fluids before a workout, and then 6-8 ounces every 15 minutes during—about 32 ounces per hour. “An electrolyte-containing sports drink, like CLIF shot electrolyte drink should be consumed to replace electrolytes lost in sweat when exercising any length of time in the heat or anytime you are working out for an hour or more,” she suggests.

Post-Workout: Refuel and Rebuild With Protein:
Once you’re done exercising, eat a snack within 30 minutes for optimal muscle recovery and energy replenishment, Bedwell recommends. The focus of your snack? Protein.

“Protein is crucial because it is the building blocks of our muscle,” Bedwell says. Studies show that having protein after a workout can significantly increase muscle mass as it aids in muscle recovery. The more muscle mass you have, the more calories you’ll burn every day, even when you’re not exercising. Plus, protein digests slowly, keeping you fuller longer and controlling your appetite for the rest of the day.

Your snack should have a ratio of 4 grams of carbs for every 1 gram of protein. The carbs will help re-energize your body after burning all that fuel during your workout. Bedwell recommends an 8-ounce glass of low-fat chocolate milk or a Luna protein bar with 1 cup of fresh grapes.

And don’t forget to keep hydrating. “One good way to make sure you drink enough after your run is to weigh yourself before and after running—the weight that you lose during the run is due to sweat,” she says. You should be drinking 16 fluid ounces for every pound lost.

On top of refueling your body properly, eating well post-workout is a great way to reinforce your hard work. You don’t want to undo all of it by choosing unhealthy foods. Giving your body what it needs will help you fully reap the benefits of exercise!