Skip to main content

Command Palette

Search for a command to run...

Your website has a carbon footprint too.

Updated
3 min read
Your website has a carbon footprint too.

Every page load burns electricity — servers, networks, your user's device. That electricity usually comes from fossil fuels. An average webpage generates ~0.5g of CO2 per visit. Multiply by trillions of visits and, yeah, the web has a carbon problem.

💡
Fun fact: your user’s device often uses more energy rendering your site than your server does serving it. Especially if you’re sending them half a megabyte of JavaScript to animate a button.

JavaScript libraries tend to be the biggest culprit here. React adds ~30kb gzipped. Angular breaks 100kb. A vanilla JS equivalent might be a tenth of that size and actually emits 45% less CO2 per operation than React, per this study on the carbon footprint of JS. All the abstractions we build on top of for the sake of maintainability, and better DX cost the atmosphere it seems.

Am I trying to make up an imaginary problem here? Here's a dramatic real-world example: Developer Danny van Kooten famously shaved 20 kB off a WordPress plugin (removing an unnecessary JS dependency) which was used on ~2 million sites. That tiny 20 kB reduction - multiplied across all those sites’ monthly pageviews reduced global emissions by an estimated 59,000kg of CO2 per month equivalent to taking 86 flights from Amsterdam to New York each month (sources in the linked article). One guy. Twenty kilobytes. Sixty tons of carbon. Because it was used on millions of sites. Your project may not have that reach but the math still applies at smaller scales.

You can use tools like Website Carbon Calculator or Ecograder which lets you plug in your URL to get an estimate of the site’s emissions. Calculating this might be a little more complex when it comes to web applications than websites, but you get the idea.

I'm not saying you should drop all the abstractions and dependencies we pile on top of our projects. Ditching a framework that genuinely makes your work faster and more maintainable isn't practical. But there are some quick wins with compounding impact:

  • Compress your images, minify your HTML/CSS/JS bundles, drop unused fonts and assets.

  • Lazy-load content, avoid auto playing videos, reduce network round-trips.

  • Consider lighter frameworks like Svelte or Qwuik which minimize runtime JS

  • Consider serverless and green hosting

The best part about implementing these changes is that your applications will load and run faster, which is a win-win for your UX. You're not going to save the planet with a code refactor. But the web was built one bad decision at a time. Cleaning it up probably works the same way.

Sources if you like reading:

More from this blog

Alan Varghese

13 posts

A mix of short (opinionated) takes, deep dives, and technical breakdowns based on my experiences as a senior engineer who ships, breaks, and learns.