CO2 emissions on the web
Published by Danny van Kooten on .
I’ve spent the last month trying to reduce the carbon footprint of the websites I have some control over. When I talk 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 one of the most effective uses of my time when it comes to reducing carbon dioxide emissions.
Just last week I reduced global emissions by an estimated 59.000 kg CO2 per month by removing a 20 kB JavaScript dependency in Mailchimp for WordPress. I cannot have that kind of effect in other areas of my life.
CO2 emissions from distributed code
All of my WordPress plugins combined run on well over 2 million different websites, and each website receives an unknown number of visitors.
At an average energy expenditure of 0,5 kWh per GB 1 of data transfer, every kB equals 0,5 kWh / 1.000.000 kB * 2.000.000 websites = 1 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 1 kWh * 10.000 visitors = 10.000 kWh.
10.000 kWh of energy produced by the current European electricity grid equals about 10.000 * 0,295 = 2950 kg of CO2.
Shaving off a single kilobyte in a file loaded on 2 million websites reduces CO2 emissions by an estimated 2950 kg per month.
To put this into perspective, that is roughly the same amount of CO2 saved each month as:
- Driving my Toyota Yaris for 18.670 kilometers. (158 g CO2 per km)
- 5 flights from Amsterdam to New York. (679 kg CO2 per flight)
- Eating 118 kg of beef. (25 kg CO2 per kg of beef)
I already work from home, eat meat only once or twice per week, 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 desktop website is about 4 times as large as it was in 2010. On mobile, where data transfer is much more expensive in terms of energy usage, the numbers look even worse: from 200 kB up to 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 add something to a website, ask yourself: is this necessary? If not, consider leaving it out.
Your blog or marketing site probably doesn’t need a JavaScript framework. You probably don’t need a CSS framework. Serve responsive images. Extend your HTTP cache lifetimes and use cache busting techniques. Enable compression. Consider replacing that heavyweight third-party analytics tool with Koko Analytics. Choose a green web host.
That is a long list, but it points in one direction: make websites more efficient and less wasteful.
Personally, I limited myself to 1 kB of CSS for the website you are reading this on. I enjoyed making that work; the constraint sparked creativity.
Let’s do our share as web developers and stop bloating the web.
Energy costs of data transfer vary a lot depending on the type of network that is used. The range seems to be from 0,08 kWh per GB for fixed broadband connections to 37 kWh per GB for 2G networks.
I initially went with a global estimate of 2,9 kWh per GB in this post (the average cost per GB for 3G networks), but later changed it to 0,50 kWh per GB as I believe that is a better estimate for 2020 2. It’s hard to come up with a good estimate that works globally, but I didn’t mean for this post to be about exact numbers anyway.
The most important thing I attempted to convey is that the choices we make in developing for the web have consequences that really add up at scale.
References
1 Pihkola, H., Hongisto, M., Apilo, O., & Lasanen, M. (2018). Evaluating the energy consumption of mobile data transfer-from technology development to consumer behaviour and life cycle thinking. https://doi.org/10.3390/su10072494
2 Aslan, Joshua & Mayers, Kieren & Koomey, Jonathan & France, Chris. (2017). Electricity Intensity of Internet Data Transmission: Untangling the Estimates: Electricity Intensity of Data Transmission. Journal of Industrial Ecology. https://doi.org/10.1111/jiec.12630