As humankind faces the threat of global warming, we are becoming increasingly aware that our every indulgence will leave its mark on the environment. This is particularly true of the food we put in our mouths.

Farming, production in factories and transport of goods are all largely powered by the burning of fossil fuels, generating greenhouse gases such as carbon dioxide and methane that trap heat in the atmosphere. Scientists measure this impact as a “carbon footprint”, commonly expressed as the volume of carbon dioxide (or equivalent) produced per 100g serving of food.

With this, it is possible to create a food pyramid based on the harm each snack and delicacy inflicts on the environment. Meat and dairy products lie at the bottom, wreaking the greatest damage, while fruit and vegetables are the most environmentally friendly at the top. Grain-based foods like bread and pasta, and confectionary lie roughly in the middle.

This approach, however, doesn’t consider how much energy our bodies get from those foods. You need to eat a far greater weight of lettuce to get the same number of calories as a rasher of bacon, for instance - with one study finding that it would release three times as many greenhouse gases to provide the same nutritional energy. Processed vegetables, or those imported from distant farms, may fare even worse.

In a paper in the American Journal of Clinical Nutrition, Adam Drewnowski at the University of Washington in Seattle and colleagues tried to take this into account by estimating the carbon emissions for every 100 calories of different foods.

Viewed in this way, the pyramid turns upside down. Now, cake or chocolate has a carbon footprint that is about a tenth of the environmental impact of tinned or frozen vegetables, for instance. Meat tends to produce about half the carbon emissions of eggs.

This shouldn’t be seen as a green card to indulge your sweet tooth – overwhelming evidence shows the excessive consumption of sugar leads to all kinds of health problems, including diabetes and heart disease. And fresh vegetables, sourced locally, will still be the best option for the environment and your health. But the data on the images below might just help you to make a more informed decision when considering how to create a balanced and sustainable diet.

Bread