Statsy is shutting down

How do we estimate carbon emission on your website?

Posted on by Thom Krupa

Your computer is actually a big contributor to the carbon footprint of your life. Whether you are a developer or a designer, it's important to understand how much energy your computer consumes and how to reduce it.

To improve your carbon footprint, you need to measure it first. Your phone, laptop or desktop you're reading right now consumes energy. The network that transforms files like HTML, CSS, images, or videos consumes energy.

Servers that generate those files, and connect to various databases or APIs all consume energy. All of it eventually run on a computer. And the computer needs energy.

The carbon cost of one kWh depends highly on the country for some countries like Sweden it would be lower for other countries like Poland it's above the global average

How do we estimate website carbon emissions?

It’s complicated, but let us break it down for you.

First, we run a test against your website to get all requests. That includes HTML, CSS, JS, images, and third-party scripts. We know exactly what page requests and what's the size of those assets.

Based on this we get the total bytes transferred over the wire. Then we run a CO2.js library. It was created by The Green Web Foundation. It's the biggest organization that focuses on building tools that speed up the transition towards a green Internet.

We use the latest Sustainable Web Design model, which takes into account several variables:

[@portabletext/react] Unknown block type "quote", specify a component for it in the `components.types` prop

CO2 Data based on country

Every country's energy generation is different. Some use fossil fuels, some are more carbon-neutral. And because of it, we need to take that into account.

We get data about countries' electricity generation from Ember Climate, an independent energy think tank that uses data-driven insights to shift the world from coal to clean electricity. Since we know where your users are located, we know what device they use and we know how much data your server transfers to them. Based on this we can calculate the co2 emission in real-time and give you a summary of the total emission for the selected time period.

The formula

We use CO2.js to calculate the energy used for every 1GB of data. The metric is universal enough to estimate network, server, and device footprint.

E = [Data Transfer per Visit (new visitors) in GB x 0.81 kWh/GB x 0.75] + [Data Transfer per Visit (returning visitors) in GB x 0.81 kWh/GB x 0.25 x 0.02]

Then we calculate the final carbon emission in grams:

C = E x [Region specific carbon-factor taken from Ember Climate database] g/kWh

You can learn more about the CO2.js calculation in the Sustainable Web Manifesto blog post.

Frontend Confidence.
Zero Worries.