Yes, it’s possible to lose weight eating only Twinkies, provided that your calories in are less than your calories out. And it’s that logic that leads many people to conclude that calories are simple math. Even astrophysicist Neil deGrasse Tyson tweeted, "A weight-loss book by physicists would be one sentence long: 'Consume calories at a lower rate than your body burns them.'" Trouble is, things are not that straightforward.

Calories In

Calories in Muffins

Calorie counts are everywhere these days, from fast food menus to fitness trackers. You might even be able to rattle off the calories in a cup of spinach. But what exactly is a calorie?

In short, it’s a measurement of energy; the “calories” seen on nutrition labels describes the amount of energy needed to heat up a gram of water by one degree Celsius. But the energy in the cranberry muffin you just ate doesn’t go to heating up water; instead, it provides fuel for a number of processes in the body, including staying alive and breathing. So figuring out how many calories are in that muffin is a bit more complicated.

How Calories Are Measured

To determine the total energy content of a food, scientists use a fancy-pants piece of scientific equipment known as a bomb calorimeter. Into this device goes our muffin, which gets completely incinerated. During that muffin-burning process, the bomb calorimeter measures the heat produced. This number represents the total amount of energy—or what is known as the “gross energy”—of the muffin.

But gross energy isn’t very helpful in indicating how much energy humans can actually get out of foods, because human digestion isn’t as efficient as a bomb calorimeter. Our digestive systems produce waste products and can’t completely break down all foods, which means that not all of the gross energy in food goes to fueling our bodies.

When you’re looking at the calorie count on muffin’s nutritional label, you’re not seeing the gross energy. What you’re seeing is the amount of energy that’s up for grabs by your digestive system, or metabolizable energy (ME). Since this is tricky to measure, we have to rely on estimates, which have been approved by the FDA as accepted ways that food manufacturers can calculate the calories posted on food labels.

One way to estimate ME involves taking the gross energy and adjusting that number downward to account for waste and digestive inefficiency. Foods containing fats and simple sugars, (like doughnuts) are fairly easy for your body to digest, so their metabolizable energy is pretty darn close to their gross energy. However, other foods with complex carbs and fiber (think a whole-grain bran muffin) take a bit more digestive power to break down, hence their ME is much less than their gross energy.

The most common method used for calculating ME is known as the Atwater System. This method uses a series of factors derived from 19th century experiments to give an approximation of the energy per gram of protein, fat, carbohydrate, and alcohol. To calculate total calories in a muffin, food manufacturers count up the number of grams of fat, protein, carbohydrate, and alcohol; multiply each by its respective factor (nine calories per gram of fat, four calories per gram of protein, four calories per gram of carbohydrate, and seven calories per gram of alcohol); and add up the totals.

Where ME Gets Murky

Though the original system remains in widespread use more scientific research Discrepancy Between the Atwater Factor Predicted and Empirically Measured Energy Values of Almonds in Human Diets. Novotny, J. A., Gebauer, S. K., and Baer, D. J. The American Journal of Clinical Nutrition, 2012; 96:296-301. has been done since Atwater’s original experiments to come up with “specific factors” for particular food groups such as dairy products.

Scientists are learning that calories calculated from the Atwater factors are more accurate for certain diets and certain foods than others. One study found that the Atwater general factors overestimated the energy content of a low-fat, high-fiber diet by 11 percent Accuracy of the Atwater Factors and Related Food Energy Conversion Factors With Low-Fat, High-Fiber Diets When Energy Intake Is Reduced Spontaneously. Zou, M. L., Moughan, P. J., Awati, A. et al. The American Journal of Clinical Nutrition, 2007; 86:1649-1656. .

More recently, USDA researchers discovered that Atwater factors overestimate the calories in a serving of raw almonds. Food labels typically list a calorie count of 160 to 170 calories per ounce of the nut, but this study showed that our bodies only absorb about 129 calories Discrepancy Between the Atwater Factor Predicted and Empirically Measured Energy Values of Almonds in Human Diets. Novotny, J. A., Gebauer, S. K., & Baer, D. J. The American Journal of Clinical Nutrition, 2012; 96:296-301. .

But this may not apply to almond butter since less-processed foods give up their energy less readily. Whereas nut butter is already ground and therefore kind of “pre-digested,” our digestive systems have to work a lot harder to break down whole almonds. Same goes for cooked foods: Raw foods, ounce-for-ounce, take more energy to break down than cooked foods (one reason some people embrace a raw food diet).

In addition to these factors, scientists are also exploring others that may impact the accuracy of the almighty calorie, such as gut bacteria, the immune system, and certain genetic variations.

Calories Out

Treadmill Calorie Tally

While it’s a tricky business to calculate the calories in food, figuring out the other side of the equation may make busting a sweat on the treadmill or powering through a heavy weightlifting session seem easy.

Measuring calorie expenditure, like measuring the calories in foods, is pretty convoluted. While there are a couple of methods that are pretty darn accurate for determining a person’s daily burn, these are very expensive and/or involve some specialized equipment—not very practical for the average person Energy Expenditure: Components and Evaluation Methods. Pinheiro Volp A. C., Esteves de Oliveira F. C., Duarte Moreira Alves R., et al. Nutricion Hospitalaria, 2011; 26:430-440. .

So we have to turn to easier, albeit less accurate, ways to tally daily energy expenditure. The Mifflin St. Jeor equation, which takes into account age, height, current weight, and sex, is the go-to for registered dietitians and weight-loss apps to estimate your caloric needs. The equation spits out a number that gives a rough estimate of a person’s resting daily energy expenditure (REE, or the energy required to simply exist, couch-potato-style). This is multiplied by a physical activity factor (such as multiplying by 1.2 for someone who does no physical activity and up to 1.9 for someone who has an intensely physical job) to calculate a rough guess of how many calories a person expends on a daily basis—but it’s only a guess.

Altogether, a person’s daily energy expenditure looks like this:

basal energy expenditure + physical activity + non-exercise activity thermogenesis + thermic effect of food = total daily energy expenditure

If that formula reads like Greek, don't worry. Let's walk through each of these components.

1. Basal Energy Expenditure (BEE)

This is basically REE, but it's measured in a slightly different way. BEE is by far the largest part of your daily burn, accounting for 45 to 70 percent of total daily energy expenditure (TDEE). It’s mostly determined by how much lean body mass you have (your total weight minus fat mass), and age, sex, genetic variations, and certain conditions (such as thyroid problems) also factor in. And yes, your body does slow the burn when in “starvation mode,” which can be triggered by too few calories and/or too much exercise. It’s your body’s way of protecting itself by pumping the breaks on losing more muscle mass The Impact of Exercise and Diet Restriction on Daily Energy Expenditure. Poehlman, E. T., Melby, C. L., and Goran, M. I. Sports Medicine (Auckland, N.Z.), 1991; 11:78-101. Metabolic Adaptation to Malnutrition. Carbonnel, F. Annales De Medecine Interne, 2000; 151:644-651. .

2. Non-Exercise Activity Thermogenesis (NEAT)

The neat thing about NEAT is its ability to bump up your burn without the sweat factor. NEAT, which includes energy spent on daily activities from fidgeting to cooking to Xbox-ing, can differ between individuals by up to 2,000 calories per day Non-Exercise Activity Thermogenesis: The Crouching Tiger Hidden Dragon of Societal Weight Gain. Levine, J. A., Vander Weg, M. W., Hill, J. O. et al. Arteriosclerosis, Thrombosis, and Vascular Biology, 2006; 26:729-736. . Fidgeting alone can burn up to 350 calories a day, and some scientists have hypothesized that lack of NEAT has contributed to America’s obesity epidemic Non-Exercise Activity Thermogenesis: The Crouching Tiger Hidden Dragon of Societal Weight Gain. Levine, J. A., Vander Weg, M. W., Hill, J. O. et al. Arteriosclerosis, Thrombosis, and Vascular Biology, 2006; 26:729-736. .

3. Physical Activity

Here’s what most of us picture when we think “calories out”: purposeful physical exercise, like Spinning class or a pick-up soccer game. While this contributes to TDEE, it varies between individuals. For most people, it’s a small chunk of daily caloric burn, but for mega-endurance athletes, it can be a pretty big piece of the pie.

4. Thermic Effect of Food (TEF)

Strangely, food itself can contribute about 10 percent of total daily energy expenditure. The thermic effect of food (TEF) is the work expended by the digestive system to digest food. Fats require relatively little energy to digest, while proteins and complex carbohydrates require quite a bit more.

Despite lots of hype to the contrary, there’s no evidence that eating smaller, more frequent meals will bump up caloric burn or help with appetite control The Effect of Eating Frequency on Appetite Control and Food Intake: Brief Synopsis of Controlled Feeding Studies. Leidy, H. J., and Campbell, W. W. The Journal of Nutrition, 2011; 141:154-157. Evidence for Efficacy and Effectiveness of Changes in Eating Frequency for Body Weight Management. Kant, A. K. Advances in Nutrition, 2014; 5:822-828. . Instead, it’s how much and what we eat that determines the energy expended by TEF.

The Takeaway

In short, the “calories in versus calories out” equation works, however it's pretty much impossible for an individual to measure either with precision. So do what works for you.

Given the inaccuracies, counting calories may seem like a waste of time, but plugging your foods into a calorie-tracking app isn’t completely pointless for everyone: There’s some evidence that writing down food intake can contribute to weight loss Self-Monitoring in Weight Loss: A Systematic Review of the Literature. Burke L.E., Wang J., and Sevick M.A. Journal of the American Dietetic Association, 2011 Jan;111(1):92-102. because food diaries help people pay attention to their choices and provide a sense of accountability. For the more numerically inclined, tracking calories, quality of foods, and weight changes will give a big picture of how meals and snacks translate into weight changes, even if calorie labels aren’t foolproof.

And if you like crunching numbers but question the whole calorie-counting thing, there are several alternative tools, such as the NuVal and Orac scales, that can help you judge the healthfulness of foods without relying on a running tally of calories.

For others, for ignoring calories completely and instead focusing on consuming whole, nutritious foods may be better. In addition to providing tons of good-for-you nutrients, these kinds of foods typically take more work to digest. If you’re looking to lose weight, try playing with proportions—bump up the fraction of unprocessed foods in your diet and see what happens.

READ THIS NEXT: Counting Calories Is Flawed. But Here's Why I Still Do It