As I write this, world leaders are gathering in Glasgow for COP26, the international climate change conference, in the attempt to halt (or at least slow down) catastrophic climate change by pledging to end their countries’ dependence on fossil fuels. Only time will tell whether they will succeed (spoiler: it’s not looking good), but one thing that’s increasingly clear is that we in the tech industry can no longer bury our heads in the sand. We all have a responsibility to ensure our planet is habitable for future generations.
It’s all too easy to disassociate climate change from the web. After all, most of us are sitting at our desks day in, day out. We don’t physically see the emissions the web is producing. But according to a report by the BBC in 2020, the internet accounts for 3.7% of carbon emissions worldwide — and rising. That puts our industry on level with the entire air travel industry. So, when I think of what we can do to make our websites “better” I immediately think of how we can make them better for the planet. Because, like it or not, the carbon emissions produced by our websites not only impact our own users, but all the people who don’t use our websites too. We certainly have a lot of work to do.
It’s no secret that web pages have been becoming increasingly bloated. The average web page size now stands at around 2MB. This is terrible news for users, whose experience of browsing such bloated sites will be very poor on slow connections, but it’s also terrible for the planet. Poor performance and energy intensity often go hand in hand. But happily, it means that fixing one will go a long way towards fixing the other — it’s a win-win. So what’s one thing we can do to improve the environmental impact of our websites (and, by extension, improve performance for our users too)?
My suggestion is that we need to set our websites a carbon budget.
Performance budgets in web development are not a new idea, and in many respects go hand-in-hand with carbon budgets. Optimizing for performance should generally have a positive impact on your website’s energy efficiency. But a quantifiable carbon budget as well helps us look at every aspect of our website through the lens of sustainability, and may help us consider aspects that a performance budget alone wouldn’t cover.
How can we begin to calculate a carbon budget for our site? Calculating the amount of carbon produced by a web page is difficult due to the many factors to consider: there’s the power used during development, the data centers that host our files, the data transfer itself, the power consumed by the devices of our end users, and more. It would be virtually impossible to perform our own calculations every time we build a website. But Wholegrain Digital’s Website Carbon Calculator tool, which estimates the carbon footprint of a given website, gives us a good jumping-off point from which to start thinking about this stuff.
Let’s take the COP26 website as an example. Running this site through the Carbon Calculator reveals some fairly shocking results: The site is dirtier (i.e. more carbon intensive) than 94% of web pages tested by the tool. Inspecting the homepage in DevTools, we can see that entire page weighs in at around 6.4MB of transferred data — way about average, but sadly not unusual. Further inspection reveals that JavaScript from social media embeds (including YouTube video embeds) are among the worst offenders on the homepage, contributing significantly to the page weight. Fershad Irani has written this detailed analysis of the areas where the site falls short, and what can be done about it. (Up until a few days ago, the total size was 8.8MB, including a 3MB PNG image. Thanks to the Fershad’s work in highlighting this to the COP26 team, the image has now been replaced with a much smaller version.)
By understanding which elements of our design have the greatest impact on performance, we can gain an understanding of where some of our biggest carbon savings could lie, and begin to make trade-offs. The carbon budget might need to be different for every site — sites that require a lot of motion and interactive content, for instance, may inevitably use more resources. But perhaps for a simple web page like this we could aim for under 1g of carbon per page view? When we think about how many page views a site like COP26 would accumulate over the period of the conference, this could amount to significant savings.
Once we can identify where possible carbon savings lie, we can do something about them. Wholegrain Digital’s article “17 Ways to Make your Website More Energy Efficient” is a good place to start. I also recommend reading Sustainable Web Design by Tom Greenwood for a practical guide to holistically reducing the environmental impact of the sites we build. The website Sustainable Web Design has some excellent development resources.
As for convincing clients to buy into the idea of a carbon budget, using Core Web Vitals to kick off that conversation is a good place to start. Using tools like Lighthouse, we can see which aspects of our site have the most impact on performance and how Core Web Vitals are affected. Seeing the impact of that code on your clients’ site performance score (which can affect Google’s search ranking) might just be enough to convince them.
It would be great to see Google (and other industry-leading companies) lead the way on this and build carbon calculations into tools like Lighthouse. By putting that information front and center they could play an important role in empowering developers to make more environmentally-conscious decisions — and show that they’re putting their money where their mouth is. (There’s actually an open GitHub issue for this.) Perhaps we also need some kind of industry-wide certification, as explored in this article by Mike Gifford.
There’s much more we can do to improve the carbon footprint of our sites. It’s time for the web industry to heed this wake-up call. In the words of Greta Thunberg:
No one is too small to make a difference.
So, agreed, but… does my webpage, even if it’s as large as 2MB (I would never), make much of a dent compared to a 4K video on Netflix? I’m not saying it isn’t worth doing, but I suspect that streaming (video, and increasingly gaming and work screen sharing) accounts for the lion’s share of that number.
By that logic you could compare many unrelated things and come to the conclusion that nothing is worth doing. First of all, small actions when done by a large number of people do add up. Secondly, it’s not just down to bytes downloaded, as not all bytes are equal – processing a JS file is more energy-intensive than a similarly-sized image. I don’t have an analysis on how a simple webpage compares to streaming a video, but on the other hand think of the Netflix homepage and how many people visit it. This could be made much more efficient and have a big impact. They could also choose (properly) green hosting. There are huge savings to be had, and discussing this stuff, as well as demonstrating what’s possible (yes, even with a small webpage), can help put pressure on companies to prioritise the environment in whatever online services they’re building.
But Netflix endeavours to ensure their stack is carbon neutral – https://about.netflix.com/en/sustainability
So, why wouldn’t you do so, too?
Hi Michelle, I wrote this for you. You do not have to publish it as a comment. https://www.usecue.com/blog/the-website-carbon-calculator/
Thank you for your article Joost, it’s very insightful. I think it’s important to have these conversations and scrutinise all claims, while also make every effort with the things that are within our control (as you are clearly doing with your own site).
You will save more by not watching a season of a tv show on netflix then optimising your website. If you really care – how about that ?
Not saying website shouldn’t be optimised, but this is not a valid reason. There are plenty of other more valid, real reasons.
An obvious difference is that not watching a show on Netflix asks someone to give up something. Optimising your website actually improves a user’s experience, so that they have to give up less – less time.
Not that one shouldn’t give things up for the environment, but if you can have a positive environmental impact without asking consumers to give something up, it’s a no-brainer.
Thanks for writing this! It’s an important and interesting concept to think about and I look forward to following more discussion around it! I also love the idea of custom Performance budgets to incorporate different priorities and goals.
This is beyond ridiculous. Just as the green washing meeting COP26. Plant more trees that these corporations are cutting down into infinity and not saying a word about it in those empty meetings but are more than willing to tax me and other average working folk for nonsense like CO2. Plants are using CO2 and are producing Oxygen. We exhale it. Circle of life! Christ!
Completely agree with you. People aims for 2mb websites when the rise of streaming is insane and eats in one day way more bandwidth than millions of small personal or companies websites in a year.
Always pushing on small entities instead of optimizing the giants.
100% agree as well.
In the end the “green movement” is more about geopolitical power and $$$, driven by blatant hypocrisy in the wide open, with a plethora of examples: See the private planes of the attendees of any “climate summit”, the analysis of this “Wholegrains” app, written by Joost van der Schee in the comments above, not to mention the ridiculousness of the “solution” of swapping out an image on the summit home page.
How many emails/phone calls/texts/messages did it take to get the maintainers of the summit site to swap that ONE image out? Oh bravo! You sure got ’em ! Who cares how many “carbon grams” you produced in that endeavor… it’s the “thought” that counts! right?… Right?
It’s stuff like this that permeates the culture of the software engineering/development industry that almost makes me loath my career.
Totally agree – this is environmental hysteria at its finest. Optimize for the end user and you will have a more efficient website. Perhaps it uses less energy, but who cares? Beyond the normal optimizations for UX & performance, it is not worth the effort.
you’re on hacker news and make a difference, indeed IMHO. https://news.ycombinator.com/item?id=29488456
Thanks for posting and for doing alean page yourself!
I completely agree with what you have written. I hope this post could reach more people as this was truly an interesting post.
Performance IS important. User Experience likewise. So trying to make your website better is a noble and actually useful endeavor which I can only wholeheartedly support, and IF it actually helps, tiny bit, the environment, all the better.
But “carbon budget” for a website is only virtue signalling, completely useless and – dare I say it – harmful, as it makes people feel like they are doing something good and exonerates their collective conscience.
Perhaps if it weren’t the case, they would be more willing to put pressure on politicians instead – for that’s where the real problem lies. Tackling climate change requires a collective pressure on politicians and governments.
We can all make our pages 1KB, commute only by bike and plant one tree a day – but it will still be completely irrelevant (even though it adds up, indeed – but to a negligible amount, earth-wise) given into account how much greenhouse gasses is emitted by China, India, Russia, USA every second.
So to sum it up – yes, make websites more performant and user friendly. But if you claim it’s for the environment, you are just virtue signalling, and probably doing more harm than good; please, stop.
I’m aware of a couple of websites that attempt to reduce carbon emissions.
https://solar.lowtechmagazine.com
Its server is solar-powered (with the UI indicating the remaining battery level), images are of low-quality (with the retro feel of half-tone texture), and fonts are the browser’s default. (For detail, read “How to build a lowtech website”.)
But it still looks pleasant to read articles (actually MORE pleasant than many websites in my opinion).
https://formafantasma.com/
This one uses Arial and Times New Roman, provides dark mode, and has no flashy image or video. (For detail, read this page of the website.)
Still, it looks elegant to me, borrowing the aesthetics of good old book typesetting.