CO2.js library
Purpose:: Estimate carbon emissions
Website:: https://www.thegreenwebfoundation.org/co2-js/
Docs:: https://developers.thegreenwebfoundation.org/co2js/overview/
Source Code:: https://github.com/thegreenwebfoundation/co2.js
Known by:: Green Web Foundation & Fershad Irani
Description
CO2.js is a JavaScript library that allows developers to estimate the emissions associated with their apps, websites and software. At its core, CO2.js takes an input of data, in bytes, and returns an estimate of the carbon emissions produced to move that data over the internet. It can be run in Node.js server environments, in the browser, as well as on some serverless and edge compute runtimes.
Data source
Energy carbon intensity
CO2.js includes yearly average grid intensity data from Ember, as well as marginal intensity data from the UNFCCC (United Nations Framework Convention on Climate Change). You can find the data in JSON and CommonJS Module format in the
data/output
folder.
Data folder: https://github.com/thegreenwebfoundation/co2.js/tree/main/data
See also Energy Carbon Intensity.
Carbon estimation models
CO2.js: Methodologies for calculating website carbon
Sustainable Web Design model
Based on the system boundaries defined by SustainableWebDesign.org.
It includes the energy used by the total system comprised of:
- the use-phase energy of datacentres serving content
- the use-phase energy network transferring the data
- the use-phase energy of user device an user is accessing content on
- the total embodied energy used to create all of the above
Constants in source code: src/constants/index.js
OneByte model
Introduced by The Shift Project in their report on CO2 emissions from digital infrastructure, Lean ICT: for a sober digital.
This returns a number for the estimated CO2 emissions for the corresponding number of bytes sent over the wire, and has been used for video streaming, file downloads and websites.
Tutorials
CO2.js: An Open Library for Digital Carbon Reporting by Fershad Irani
Start calculating digital carbon emissions in 5 minutes with CO2.js - The Green Web Foundation
CO2.js: An Open Library for Digital Carbon Reporting - Branch by Fershad Irani
Examples on how to display the information
low-carbon.digital
This page loaded in 0.71 seconds, produced just 0.009g of CO2, and is powered by renewable energy. Emissions are calculated using CO2.js and the Sustainable Web Design model.