Skip to main content
Open component, MIT licence

Show visitors your page’s estimated CO₂e.

Paste one tag and the badge shows grams of CO₂e per page load with a letter from A+ to F. It fits a footer, an about page or a sustainability page.
Free, with no account or API key. The visitor’s browser calculates the result, and it stays on their device. You can also host the component file on your own server.
Source on GitHub, MIT Project website Package on npm
cometweb.io/carbon-badge live
Variant
Theme
Calculated locally for this page. N/D means incomplete data, not zero emissions.
How it works

From pasting the code to a result on the page.

  1. You paste one tag

    The script and the component tag before the closing body tag. No account or server setup.
  2. The browser counts transfer

    The component reads the Performance API of the current page load, locally.
  3. The badge shows CO₂e

    The SWDM v4 model turns transfer into an estimate. With incomplete data the badge shows N/D.
Web Component

A live estimate, calculated on the visitor’s device

The component checks the current page load in the browser and shows a CO₂e estimate. It makes no result request and starts no server scans.
  • Local calculation, no API
  • No cookies or localStorage
  • N/D instead of guessing when data is missing
This estimates the transfer of one page load. It is not an energy measurement or an ESG certificate.
Light, SVG with no JavaScript

A published measurement as a single image

In Insight you confirm your domain with an HTML meta tag or DNS record, choose a saved measurement and publish it. On your site you paste one SVG image linking to the details: date, method and data source.
  • Confirmed domain
  • A page with the measurement details
  • 0 B of JavaScript on your site
Light shows a published measurement and does not measure the visitor’s page.
Open an Insight account
Install

Choose a look. Paste the code.

Set the variant and theme in the preview at the top. The code below follows them.

Where to host the file

The browser downloads a pinned static file from cometweb.io. It calculates on-device, without requesting Insight scans.
Download ESM file
v2.0.7, SRI integrity check included
The local mode writes no cookies or localStorage. File downloads are subject to ordinary hosting logs. Cross-origin resources may hide their size, in which case the badge shows N/D.

Paste before the closing body tag

<script type="module" src="https://cometweb.io/scripts/carbon-badge/2.0.7/cometweb-carbon-badge.esm.js"
  integrity="sha384-5bPSZPDLIucHdDGUKNmjLyfW/G6WfaEuJwSQ3Pn2NpMCb0oyonTqY4YN1wfqNiBN" crossorigin="anonymous"></script>
<cometweb-carbon-badge mode="estimate"
  theme="dark" variant="default" lang="en"></cometweb-carbon-badge>
If your site uses CSP, allow the script origin in script-src. The estimate describes the current page load and can vary between devices.
Details

Attributes and score bands

Score bands, g CO₂e per page load
A+ < 0.10 g
A < 0.20 g
B < 0.40 g
C < 0.70 g
D < 1.00 g
F ≥ 1.00 g
The grams of CO₂e come from the SWDM v4 model. The A+ to F letters are CometWeb’s presentation scale, not thresholds published by Sustainable Web Design. This estimates page transfer, not an organisation’s footprint or an ESG certificate.
Component attributes
modeestimate, the default local mode
themedark | light
variantdefault | compact | minimal
langpl | en
urlNot needed. The local badge uses the current page, without query parameters or fragment.
  • SWDM v4CO₂e estimation model
  • 14 kB gzipversion 2.0.7
  • dark and lighttwo themes, three variants
  • MITmodify and self-host the source

Want to know what to fix on your site?

The badge shows one indicator. Insight checks performance, SEO, accessibility, security and ecology, then orders the fixes.

No credit card Report with date and sources Free account in the app