UNLESS YOU’VE GOT a Ph.D. in biochemistry, you’re probably exhausted from the endless debate surrounding sugar.

And if your info has come largely from television, you’re hopelessly confused. If you eat too little sugar, you don’t have the energy to work out; too much sugar, and you get fat. Fortunately, getting the right kinds of sugar is really a simple matter of figuring out what kinds of sugar to eat—and when—to lose weight, build muscle, and protect your health.

Here’s a look at which sugars are good for your body—and when you should eat them.

The science of sweet

All sugars are carbohydrates, known as “simple” carbs, since they’re composed of just one sugar molecule. The label on a can of Pepsi reads 41g of carbs and 41g of sugar. This means that every single carbohydrate comes from sugar. The label on a package of plain oatmeal will read 18g of carbs and only 1g of sugar. Almost all of the carbs in oatmeal are made up of long chains of sugar molecules called “complex” carbs. Oatmeal—along with sweet potatoes, wheat breads, rice, and corn—is a complex carb.

But in this age of convenience foods, the terms “complex” and “simple” are a bit outdated. For the purpose of losing fat and building muscle, it’s smarter to look at carbs as “unrefined” vs. “processed.” The former refers to whole foods that contain sugar—fruits, vegetables, juices, grains, and legumes—while still holding onto their natural water, fiber, phytochemicals, vitamins, and minerals. “Processed” foods include white bread, soda, candy, crackers, cookies, and just about any commercial product labeled “fat-free.” These have often been stripped of their wholesome attributes and are filled with nothing but “empty calories”—simple sugars, for instance. For example, 1g of a cracker will contain 4 calories, but 1g of an orange contains about 0.2 calories, because the bulk of its weight is water and fiber.

The glycemic index

The glycemic index rates how quickly certain foods turn into glucose (a form of sugar) in the bloodstream, and is a valuable tool when trying to control sugar intake and limit its effect on you. While high-GI foods can cause a rapid jump in blood sugar, followed by a massive crash, low-GI foods increase blood sugar slowly, providing constant and stable energy levels over a considerable period of time. Several factors contribute to a low rating, such as the presence of protein, fiber, and fat. Pure processed sugars garner the highest (i.e., worst for you) scores, with the most highly processed foods topping the list. For instance, out of a possible 100, instant rice earns a 90, while fibrous, vitamin-rich brown rice gets a 55.

So what’s the difference? Recent studies by the Harvard School of Public Health show that diets loaded with high-GI foods lead to an increased risk of type-2 diabetes, coronary heart disease, and obesity. In fact, the World Health Organization is spearheading a movement to include GI ratings on food labels, and several products in Australia already bear the grade.

The dreaded insulin dump

Although sugar is lower in total calories per gram than fat, it contributes mightily to a fatty frame. “In our society, sugar is consumed in excessive amounts through unhealthy foods, and it increases total calories, leading to weight gain,” says Eric Sternlicht, Ph.D., professor of kinesiology at Occidental College in Los Angeles, and president of Simply Fit Inc.

This effect is largely due to a hormone called insulin. The more highly processed sugar you eat, the greater the release of insulin from the pancreas. That’s because the main role of insulin is to return blood-sugar levels to normal. However, when blood-sugar levels jump violently—which is what happens when you eat high-GI foods—your body pumps a massive amount of insulin into the bloodstream. This causes an overshoot, making blood-sugar levels bottom out, which triggers appetite, leading to a vicious cycle of overeating. In fact, sugar is often compared to a drug, rather than a nutrient, because of how it can leave you craving more instead of leaving you satisfied.

Overeating isn’t the only danger. Some doctors, including Walter Willet, M.D., chairman of the department of nutrition at the Harvard School of Public Health, believe that years of eating processed food and experiencing the constant blasts of insulin can actually exhaust your pancreas’ ability to produce insulin, putting you at risk for diabetes. Another condition, known as insulin resistance, can also develop, in which your body is so accustomed to insulin surges, the hormone loses its power to reduce levels of blood sugar. Recent research published in the British Medical Journal shows that men with elevated blood-sugar levels have a higher mortality rate from cardiovascular disease.

The upside of sugar

After all that, it’s normal to think that sugar—or even carbs altogether—is essentially evil. But it does have its benefits, especially if you’re active.

“Sugar has a bad connotation attached to it,” says Sternlicht. “But in moderation, unrefined sugars are an important and vital part of your diet.” Sugar that is needed for activity—such as weight training or a cardio workout—can be used as fuel, while any excess will be stored in the liver and muscles as glycogen for later use. Unfortunately, our storage space is limited, and anything left over turns to fat.

This balancing act is a result of science which shows that sugar boosts performance. “[Any kind of] carbs taken during exercise improve endurance performance, especially if an athlete is competing for a prolonged period of time during which stores would be depleted,” says John Ivy, Ph.D., a professor in the department of kinesiology and health education at the University of Texas, Austin. “In fact, there’s even some indication that carbs also improve short-term performance of intense exercise as brief as 20 minutes.”

Each person reacts individually to sugar, but regardless of one’s metabolism, paying strict heed to the following rules will keep your training efforts on track.