Before you upgrade your next iPhone, you may want to consider a $29 battery instead. Not only will the choice save you money, it could help save the planet.

A new study from researchers at McMaster University published in the Journal of Cleaner Production analyzed the carbon impact of the whole Information and Communication Industry (ICT) from around 2010-2020, including PCs, laptops, monitors, smartphones, and servers. They found remarkably bad news. Even as the world shifts away from giant tower PCs toward tiny, energy-sipping phones, the overall environmental impact of technology is only getting worse. Whereas ICT represented 1% of the carbon footprint in 2007, it’s already about tripled, and is on its way to exceed 14% by 2040. That’s half as large as the carbon impact of the entire transportation industry.

Smartphones are particularly insidious for a few reasons. With a two-year average life cycle, they’re more or less disposable. The problem is that building a new smartphone–and specifically, mining the rare materials inside them–represents 85% to 95% of the device’s total CO2 emissions for two years. That means buying one new phone takes as much energy as recharging and operating a smartphone for an entire decade.

Yet even as people are now buying phones less often, consumer electronics companies are attempting to make up for lost profits by selling bigger, fancier phones. The researchers found that smartphones with larger screens have a measurably worse carbon footprint than their smaller ancestors. Apple has publicly disclosed that building an iPhone 7 Plus creates roughly 10% more CO2 than the iPhone 6s, but an iPhone 7 standard creates roughly 10% less than a 6s. So according to Apple, the trend is getting better, but the bigger phones companies like Apple sell seem to offset some gains. Another independent study concluded that the iPhone 6s created 57% more CO2 than the iPhone 4s. And despite the recycling programs run by Apple and others, “based on our research and other sources, currently less than 1% of smartphones are being recycled,” Lotfi Belkhir, the study’s lead author, tells me.

In any case, keeping a smartphone for even three years instead of two can make a considerable impact to your own carbon footprint, simply because no one has to mine the rare materials for a phone you already own. It’s a humbling environmental takeaway, especially if you own Samsung or Apple stock. Much like buying a used gasoline-fueled car is actually better for the environment than purchasing a new Prius or Tesla, keeping your old phone is greener than upgrading to any new one.

Smartphones represent a fast-growing segment of ICT, but the overall largest culprit with regards to CO2 emissions belongs to servers and data centers themselves, which will represent 45% of ICT emissions by 2020. That’s because every Google search, every Facebook refresh, and every dumb Tweet we post requires a computer somewhere to calculate it all in the cloud. (The numbers could soon be even worse, depending on how popular cryptocurrencies get.) Here, the smartphone strikes again. The researchers point out that mobile apps actually reinforce our need for these 24/7 servers in a self-perpetuating energy-hogging cycle. More phones require more servers. And with all this wireless information in the cloud, of course we’re going to buy more phones capable of running even better apps.

As for what can be done on the server end, Belkhir suggests that government policies and taxes might make a difference–whatever needs to be done to get these servers migrated over to renewable energy sources. Google, Facebook, and Apple have all pledged to move to 100% renewable energy in their own operations. In fact, all of Apple’s servers are currently run on renewable power. “It’s encouraging,” says Belkhir of these early corporate efforts. “But I don’t think it’d move the needle at all.”