CO2 emissions on the web

Published on Permalink

I’ve spent the last month trying to reduce the carbon footprint of the websites I have (some) control over. When talking about this with other people they often look at me blankly before asking “aren’t you taking this a little too far?”.

The simple answer is no. In fact, it is probably the most effective use of my time when it comes to reducing carbon dioxide emissions.

Just last week I reduced global emissions by about 340.000 kg per month by removing a 20 kB JavaScript dependency in Mailchimp for WordPress. There’s no way I can have that kind of effect in other areas of my life.

Carbon emissions from distributed code

All of my WordPress plugins combined run on well over 2 million different websites, each website receiving who knows how many visitors.

At an assumed average energy expenditure of 2,9 kWh per GB 1 this means that every kB saved equals an energy reduction of about 2,9 kWh / 1.000.000 kB * 2.000.000 websites = 5,8 kWh if each of these websites received exactly 1 visitor.

Let’s assume the average website receives about 10.000 unique visitors per month and serves files from cache for returning visitors. The total amount of energy saved by shaving off a single kilobyte is then 5,8 kWh * 10.000 visitors = 58.000 kWh.

58.000 kWh of energy produced by the current European electricity grid equals about 58.000 * 0,295 = 17.110 kg of CO2.

Shaving off a single kilobyte in a WordPress plugin running on 2 million websites reduces CO2 emissions by 17.110 kg per month!

To put this into perspective, that is the same amount of CO2 saved per month as:

Ignoring the absurdity of those numbers, I already work from home, am a vegetarian and didn’t take any flights in the last 3 years so it seems I am stuck trying to make the web more efficient.

What can we do?

According to httparchive.org, the average website on desktop is about 4 times as large as in 2010. On mobile, where data transfer is way more expensive in terms of energy usage, the numbers look even worse: from 200 kB up to a whopping 1,9 MB!

As web developers we have a responsibility to stop this madness. Did websites really get 4 times as good? Is this motherfuckingwebsite.com clocking in at 5 kB in total really that bad in comparison? I don’t think so.

Whenever you are adding to a website, ask yourself: is this necessary? If not, consider leaving it out.

Your content site probably doesn’t need JavaScript. You probably don’t need a CSS framework. You don’t need a custom font, especially not one served from Google’s servers. Use responsive images. Choose a green web host. Consider ditching that third-party analytics service that you never look at anyway, especially if they also sell ads. Run your website through websitecarbon.com. Extend your HTTP cache lifetimes. Use a static site generator or wp2static.com instead of dynamically generating each page on the fly, despite never changing.

I’m sorry if that turned into a bit of a rambling, but I hope you see where I am going with this. Personally I really enjoyed forcing myself not to use more than 1 kB of CSS for the website you are reading this on. It sparked creativity.

Let’s do our share as web developers and stop bloating the web.

1 Energy expenditure numbers vary a lot depending on the network you are using. “Using data volumes from the year 2010 Malmodin and colleagues estimated electricity consumption per data volume as follows: 0.08 kWh/gigabyte for averaged fixed broadband access network, compared to 2.9 kWh/gigabyte for average 3G mobile broadband access network and 37 kWh/gigabyte for average 2G mobile communication.”, doi:10.3390/su10072494