It’s Halloween time. For many, this time of the year means there are lots of cool costumes. For others, it’s all about the candy. Now, I’m not a big fan of candy—but I am a big fan of analyzing stuff. So here we go: I’m going to look at the energy density for candy. Sure, I could just look this up—but it’s much more fun to determine it for myself.

Let’s get started by going to the store. I am going to look at a bunch of different candy options and get some data. Fortunately, food has to contain some basic information on the package: mass, calories, sugars, fats, carbs. I can also get the price.

But what do you do with a lot of data? You start making graphs. I will start off with a plot of calories vs. mass. But wait! I don’t want to use calories as a unit of energy because it’s a pretty dumb unit. The silliest thing about a calorie is that there are actually two different calories. In chemistry, there is a calorie where 1 calorie is the energy needed to raise gram of water by one degree Celsius. Then there is the food calorie which is equivalent to 1000 chemistry calories. Of course, in both cases people just call them “calories”.

For me, I will stick with the joule as a unit of energy. For the conversion, 1 food calorie is equal to 4,184 joules.

Now for a quick run down to the convenience store to gather candy … ahem, data. I’m assuming here that you all trick or treat in only the *best* neighborhoods—you know, the ones that hand out full-sized candy bars. With a look at individual candy bars (and other stuff), I grabbed the mass and energy in 20 different sweet treats, from M&Ms and KitKats and Twix to Sweet Tarts and Skittles and Sour Patch Kids.

Here is a plot of energy in joules vs. mass in kilograms. (You can see the full list of candy the “data” tab if you click on the plot.)

It’s not a perfect linear relationship between mass and energy, but it’s close—and that relationship gives you a candy’s energy density. The energy density is just the energy in the bar divided by the mass of the bar. Technically this energy per mass would be called the “specific energy”—since it is per mass instead of per volume. But it’s still the same idea, and I like the term energy density better.

There are some outliers, like that data point far up to the right with almost 4 MJ of energy in 144 grams of candy—a super-high energy density. Can you guess what it is? A Lindor truffle! The one that lies below the line of best fit, just over 1.5 MJ, has a lower than average energy density—that’s *gummy bears*. Oh, one more outlier: Hershey’s Cookies & Cream. That has a pretty low energy density too.

All candies are not equal; some might have more stuff in them that does not add to the total calorie value. But overall, there seems to be fairly nice correlation between candy mass and candy energy. From the graph, candy has an energy density around 22 megajoules per kilogram. But how does this energy density compare with other things? Gasoline has 46.4 megajoules per kilogram and a lithium-ion battery is somewhere under 1 MJ/kg. Where should candy be on this spectrum? The closest thing I could find is glucose with an a specific energy of 15.5 MJ/kg. That’s pretty close to my value of 22 MJ/kg from the data above.

Just for fun, here is one more plot. What about a plot of energy in the candy vs. the price?

Again, there is a fairly linear relationship between energy and cost. From the graph, I get about 7.5 megajoules per dollar. (If you think Lindor truffles are too expensive, this actually argues in their favor; their cost-to-energy ratio is in line with other “cheaper” candies.) But no matter what you get, it’s clear that there is a bunch of energy in candy bars. What are you going to do with all the energy you collect on Halloween?