CO2.js v0.18 changes the default carbon estimation model to Sustainable Web Design Model (SWDM) version 4. It also see the addition of open, year grid intensity and fuel-mix data from from Electricity Maps.
Sustainable Web Design version 4 is now the default estimation model
Users who are using CO2.js for website carbon estimation projects should be aware that the default estimation model has been updated to the Sustainable Web Design Model version 4 (SWDMv3) calculation.
All users who use CO2.js for carbon estimation without explicitly declaring the estimation model and version to use will be impacted by this change. They will see lower emissions results from the updated version. We’ve explained more about the difference between the two version of the Sustainable Web Design Model in Understanding the latest Sustainable Web Design Model update.
This will impact users who are performing carbon estimation in CO2.js in the manner shown below:
import { co2 } from "@tgwf/co2";
// No model or version declared
const swd = new co2();If you want to continue using SWDMv3 for carbon estimation in your code, you should declare it:
import { co2 } from "@tgwf/co2";
// Declared model and version
const swd = new co2({ model: "swd", version: 3 });Users returning results by segment
Users who are returning results per segment using the Sustainable Web Design Model without explicitly declaring the estimation model and version to use will be impacted by this change. SWDMv4 returns different results with different keys compared to SWDMv3, thought the total key (representing the total CO2e result) remains unchanged.
This will impact users who are performing carbon estimation in CO2.js in the manner shown below:
import { co2 } from "@tgwf/co2";
// No model or version declared
const swd = new co2({ results: "segment" });If you want to continue using SWDMv3 for carbon estimation in your code, you should declare it:
import { co2 } from "@tgwf/co2";
// Declared model and version
const swd = new co2({ model: "swd", version: 3, results: "segment" });Below is a diff of the keys returned by SWDMv3 (-) and SWDMv4 (+):
perVisit
SWDMV3 {
- "consumerDeviceCO2 - first": 0.00014940174600000002,
- "consumerDeviceCO2 - subsequent": 9.9601164e-7,
- "networkCO2 - first": 0.00004022354700000001,
- "networkCO2 - subsequent": 2.6815698000000004e-7,
- "productionCO2 - first": 0.0000545890995,
- "productionCO2 - subsequent": 3.6392733e-7,
- "dataCenterCO2 - first": 0.00000455625,
- "dataCenterCO2 - subsequent": 3.0375e-8,
"total": 0.00025042911345
}
SWDMV4 {
+ "dataCenterOperationalCO2e": 0.00002717,
+ "networkOperationalCO2e": 0.000029145999999999995,
+ "consumerDeviceOperationalCO2e": 0.00003952,
+ "dataCenterEmbodiedCO2e": 0.000005928,
+ "networkEmbodiedCO2e": 0.000006422,
+ "consumerDeviceEmbodiedCO2e": 0.000040014,
+ "totalEmbodiedCO2e": 0.000052364,
+ "totalOperationalCO2e": 0.000095836,
+ "dataCenterCO2e": 0.000033098,
+ "networkCO2e": 0.000035567999999999996,
+ "consumerDeviceCO2e": 0.000079534,
+ "firstVisitCO2e": 0.00012103,
+ "returnVisitCO2e": 0,
"total": 0.00012103
}perByte
SWDMV3 {
- "consumerDeviceCO2": 0.00019920232799999998,
- "networkCO2": 0.000053631396000000005,
- "productionCO2": 0.000072785466,
- "dataCenterCO2": 0.0000060749999999999994,
"total": 0.00033169419
}
SWDMV4 {
+ "dataCenterOperationalCO2e": 0.00002717,
+ "networkOperationalCO2e": 0.000029145999999999995,
+ "consumerDeviceOperationalCO2e": 0.00003952,
+ "dataCenterEmbodiedCO2e": 0.000005928,
+ "networkEmbodiedCO2e": 0.000006422,
+ "consumerDeviceEmbodiedCO2e": 0.000040014,
+ "totalEmbodiedCO2e": 0.000052364,
+ "totalOperationalCO2e": 0.000095836,
+ "dataCenterCO2e": 0.000033098,
+ "networkCO2e": 0.000035567999999999996,
+ "consumerDeviceCO2e": 0.000079534,
"total": 0.00012103
}Open Yearly Grid Data from Electricity Maps
Annual grid data from Electricity Maps is now available in CO2.js for the years 2021 – 2025. This data gives developers access to annual grid intensity, renewable energy, and carbon-free energy data for over 350 national and regional energy grids around the world.
Data like this is extremely useful for developers and organisations looking to understand the states of the energy grids they operate on. They also provide valuable insights about the progress of the energy transition around the world. Annualised data is an entry point for those looking to take their first steps towards carbon reporting, decision making, or surfacing carbon emissions and grid data in the tools and apps they are building.
You can import annual, country-level average grid intensity data from Electricity Maps into your projects directly from CO2.js. For example, if you wanted to use the average grid intensity for the United Arab Emirates in a project, then you can do so by using the code below:
import { yearly2025, yearly2024, yearly2023, yearly2022, yearly2021 } from '@tgwf/co2/data/electricity-maps';
const data2025 = yearly2025.data["AE"]
console.log({ data2025 })
// Returns
AE: {
carbonIntensity: { value: 348, unit: "gCO2eq/kWh" },
renewableEnergy: { value: 9, unit: "%" },
carbonFreeEnergy: { value: 31, unit: "%" },
},Accessing other Electricity Maps data
While we are able to provide annual grid data from Electricity Maps in CO2.js, users wishing to utilise data at higher-than-yearly resolution (e.g monthly, hourly etc.), or other historical and forecasted datapoints should contact Electricity Maps to access this data via their paid API. To do so, visit the Electricity Maps website for pricing and details.
Licenses
The annual grid intensity data is republished from Electricity Maps under the Open Database License (ODbL). Users of this data through CO2.js must:
- Attribute: Credit Electricity Maps as the source
- Share-Alike: Keep derivative works under the same license
- Keep open: Provide unrestricted versions if using DRM
For full details on Electricity Maps methodology see: https://www.electricitymaps.com/data/methodology For full detail on the ODbL see: https://opendatacommons.org/licenses/odbl/summary/
To stay up-to-date with releases and CO2.js news, you can also subscribe to our mailing list.
You can find details of every release for CO2.js on GitHub, where you’ll also be able find the changelog for this project.
