Every year, the world produces roughly 10 million metric tons of coffee beans. After all that brewing, millions of tons of used grounds get tossed in the trash. Now, scientists in Tarragona, Spain have found a better way to handle what gets left behind in the cup.

Researchers at the Universitat Rovira i Virgili have discovered how to turn spent coffee grounds into biodiesel fuel and other useful products. Their study, published in the journal Biomass and Bioenergy, shows that coffee grounds contain about 15% lipids — fats that can serve as a raw material for making biodiesel.

The team, including Jorge F. Romero, Alberto Tampieri, Daniel Montané, Magdalena Constantí, and Francesf Medina from the university's Department of Chemical Engineering, tested different ways to extract this oil. They found that heating the grounds to 45 degrees Celsius for 60 minutes while mixing them with a solvent called n-hexane recovers roughly 90% of the available oil. The resulting oil is surprisingly clean, with impurity levels of only 0.3%, compared to 3.9% using a traditional laboratory method called Soxhlet extraction.

The fatty acids in the extracted oil — mainly linoleic and palmitic acids — are exactly the kind needed for biodiesel production, making the oil a promising fuel source.

But the researchers wanted to go further. They designed their process to keep the rest of the coffee grounds intact so that material can still be used. What remains after removing the oil is called the lignocellulosic matrix, made up of components like cellulose, hemicellulose, and lignin. These ingredients can be turned into other products such as bioethanol, lactic acid, or even components for sustainable aviation fuels.

"In our study, we also demonstrate that extracting the oil does not mean that the rest of the material cannot be used for something else," said Medina.

The team compared their method to alternatives like ultrasound or microwave-assisted extraction, but found that those faster techniques did not offer enough advantage in oil quality, overall efficiency, or energy use to justify switching. The moderate-temperature approach appears better suited for scaling up in real-world biorefineries.

This work fits into broader efforts to build a circular economy — a system where waste gets transformed into new products instead of piling up in landfills. By using every part of the coffee grounds, the researchers aim to reduce environmental harm while creating renewable fuels for sectors that are difficult to electrify, such as heavy trucks and aircraft.

"We transform a typically underused waste product into various energy vectors and bio-based chemical products, and reduce the environmental impact associated with its accumulation," said Montané. This opens a path toward producing biofuels more sustainably, one cup of coffee at a time.