You’re kicking butt in the gym, mixing HIIT workouts with circuit training. But the results? Not exactly what you were hoping for. If you’re not building muscle or getting leaner, it could mean that you need to revamp your recovery diet. After all, your muscles need to refuel and repair after pushing you toward the finish line or carrying you through a CrossFit WOD. And real, whole foods will do the job, as long as you choose the right kind.

Many experts actually say that nutrition could be even more important than the workout itself. “If you don’t show up for meals, you might as well not show up for a workout,” says Nancy Clark, RD, a Boston-based dietitian and author of Nancy Clark’s Sports Nutrition Guidebook. “Eating is part of the training program, not an additional, optional add-on.” That’s because, if you want make it through another workout, you have to replenish the energy your muscles lost.

So what’s the best post-workout snack to feed your body? And do you really need it within 30 minutes of your sweat sesh? Here’s everything you need to know to ace your workout nutrition.

Post-Workout Snacks: When You Need One, When You Don’t

When to Pass: You don’t always need to eat the second you stop exercising. If you just did a casual bike ride or lifted light weights for 30 minutes without elevating your heart rate much, you can hold off on food until your next meal, says Mary Jane Detroyer, a nutritionist and personal trainer in New York City. Yoga and some Pilates classes might also mean you can skip a snack, especially if you feel like you’re raring to go afterward. “If you still have a half-tank of gas less, then fueling immediately after isn’t as urgent,” says Clark. Your muscles continue to recover over the course of 24 to 48 hours, so don’t feel the need to always nibble.

If you ate before heading to the gym, you can also pass on the après fuel, especially if weight loss is your goal. “Most people don’t need both a pre-workout snack and a post-workout snack,” says Detroyer. This only increases your total calorie intake and could mean you take in more than you’re burning off — aka you no longer have a calorie deficiency, which you need to drop pounds.

When to Fuel: Logging an hour of vigorous running, biking or rowing — or any activity that feels intense and gets your heart pumping — will require a bite. And it should happen in that 20- to 30-minute window. That’s when “your muscles are more receptive to absorbing the glucose into the cells,” Detroyer explains. Stash something in your gym bag, like a mini box of raisins, a few pretzels or some chocolate milk to get your quick fix.

You’ll also want something to munch on if you’re a morning workout person who avoids eating beforehand. In this case, your best bet is having a full breakfast after your sweat session, says Angie Asche, RD, founder of Eleat Sports Nutrition. A meal will keep you from double dipping into the calorie bank (as you would with a snack and a meal), while also stopping you from being ravenous later. A few of Asche’s favorite a.m. dishes: a two-egg omelet with veggies, a half-cup of oats with nut butter and banana slices, or three-ounces of fish and a sweet potato with a drizzle of honey and cinnamon.

No matter what type of exercise you do, your muscles always need two key macronutrients: carbs and protein. How much of the two you need will vary slightly, depending on whether you lifted weights in order to gain muscle or tackled a long endurance-building run. Either way, you’ll still need carbs to refuel glycogen (what gives your muscles energy to move) and protein to rebuild and repair muscle tissues, says Asche.

In general, try get about 0.5 grams per kilogram of your bodyweight of carbohydrates within 30 to 60 minutes of sweating and an additional 1.5 grams per kilogram body weight within two hours. Fruit, oats, quinoa, rice, bread and potatoes will all help you get there. For adequate protein, aim for 10 to 15 grams within at least an hour of exercise. Good sources include nuts, seeds, milk, eggs and meat. Don’t want to overdo it on the calories? Stick to about 200 for a snack and around 500 if you’re having a meal, Asche suggests. Mathletes: If you’re tracking macros on the go, remember that both protein and carbs pack four calories per gram.

To adjust for your specific exercise, you just have to tweak the carb to protein ratio. For those focusing on weight training, Detroyer suggests aiming for 2:1. A half cup of cottage cheese and pineapple, a half a turkey sandwich on whole wheat bread or a small glass of OJ with beef jerky will all boost muscle gains.

If you’re training for a long-distance race and doing more cardio, your optimal carb to protein ratio is 4:1. While in your overall diet, low-glycemic carbs are best — they slowly release glucose into your system, so blood sugar doesn’t spike so quickly — right after exercise, you actually want high-glycemic snacks, say Detroyer. Try dried fruit or a baked potato. (Take note: Fiber and fat delay glucose absorption, so avoid chowing down on too many full-fat dairy or grains immediately after exercise.) Some other smart grab-and-go ideas: a smoothie with yogurt, banana and berries or pair six Triscuit crackers with a Babybel cheese wheel. Consider your hunger cured and muscles recovered!