You walk into the grocery store with the best intentions, filing your cart with kale, broccolini, tofu and Greek yogurt.

Then you get home, feel pressed for time and order a pizza.

Before you know it, the perishables are going bad at the back of the fridge. They’ll wind up in the trash, like so many other well-intentioned meals that never came to be.

Your efforts to eat better have flopped again. But that’s not your only fail. You’ve also squandered the natural resources used to produce that food and contributed to environmental degradation for nothing.

If you’re ready to accept the full guilt of the situation, you’re in luck: Researchers have added it up for you.

According to a new report in the journal PLOS One, we Americans wasted just more than 25 percent of our food between 2007 and 2014.

Although we did a decent job of finishing up our nuts and seeds (only 12 percent wasted) and potatoes (about 16 percent wasted), we were not as careful with seafood (nearly 35 percent wasted), whole fruit (almost 33 percent wasted) and soups (30 percent wasted).

Incredibly, Americans even wasted 23 percent of our bacon, 26 percent of our grain-based desserts (think cookies, cakes and brownies), and 29 percent of our salty snacks.

Each year, just short of 4.2 trillion gallons of water were used to produce all this uneaten food. That includes nearly 1.3 trillion gallons of water to grow uneaten fruits and 1 trillion gallons of water to grow uneaten vegetables.

In addition, farmers used 1.8 billion pounds of nitrogen fertilizer (which affects marine and terrestrial ecosystems), 1.5 billion pounds of phosphorus fertilizer (which can feed algal blooms that are dangerous to fish) and 2.3 billion pounds of potassium-containing potash fertilizer annually to grow these wasted crops. They also applied nearly 780 million pounds of pesticide to protect food that never passed our lips.

The study authors also broke things down on a per-capita basis. On an average day, an average American wasted a little less than a pound of food (422 grams). That represented a dietary loss of more than 800 calories per person per day.

Fruits and vegetables accounted for 39 percent of that waste, and dairy items contributed an additional 17 percent. At the other end of the spectrum, egg dishes made up less than 1 percent of the waste, as did the combined category of table oils and salad dressings.

The research team, led by Zach Conrad of the U.S. Department of Agriculture’s Grand Forks Human Nutrition Research Center in North Dakota, put all this together by linking information in a variety of government databases.

For instance, they gleaned information about Americans’ diets from the National Health and Nutrition Examination Survey, which is conducted by the Centers for Disease Control and Prevention. To find the ingredients in those diets, they used the Environmental Protection Agency’s Food Commodity Intake Database. Surveys conducted by the USDA provided information about agricultural resources such as water and pesticides, and the department’s Economic Research Service provided data to calculate food waste.

The results revealed substantial variance in the quality of Americans’ diets. On a scale of 0 to 100, those in the bottom 20 percent scored an average of 32, while those in the top 20 percent scored an average of 82. (Nationwide, the average was 58.)

One trend was unmistakable: The higher the diet quality, the more food was wasted. Americans in the bottom 20 percent wasted an average of 295 grams of food per day, while those in the top 20 percent wasted an average of 535 grams of food per day.

The more healthful your diet, the more water and pesticides you wasted as well, the researchers reported.

Past studies have focused on the environmental benefits of producing (and ultimately consuming) fewer animal-based foods and shifting instead to foods that come from plants. But the new findings show that it’s not that simple.

“Improving diet quality and reducing environmental impact are efforts that should be pursued concurrently,” Conrad and his colleagues wrote. “Consumers should increase their consumption of fruits and vegetables and simultaneously waste less of them.”

The study authors acknowledged that this was easier said than done. One way to reduce food waste is to buy fewer perishable goods and choose canned or packaged foods that have a longer shelf life. But these items often contain more sodium, saturated fat and added sugar. Still, the situation is not hopeless.

Americans would waste less food if they knew more about “how to tell when fruits and vegetables are ripe, how to store and prepare them, and how to tell the difference between bruises/abrasions and spoilage,” the researchers wrote.

Bringing some clarity to the “sell by,” “use by” and “best before” dates that are printed on packages could also stop consumers from tossing perfectly good items into the garbage, they added.

In the longer term, engineers are developing sensors that can alert people when food has actually spoiled, reducing the risk that they will wind up sick.

“It is important to ensure that efforts to reduce food waste at the consumer level do not undermine legitimate food safety concerns,” the study authors wrote. “Spoiled food is a health risk.”