Website Carbon Calculator
Estimate CO2e per page view of a URL or byte count with the Sustainable Web Design model v4 (CO2.js): page weight, A+–F rating, yearly total, fixes.
Result
Press “Run” to see the result.
Give a url and the API loads the page like a first visit: the HTML, stylesheets, scripts, non-lazy images, preloads, icons, iframes and the web fonts referenced by same-site CSS (up to max_resources, default 40, max 80), and adds up the bytes sent over the network (Content-Length, or a gzip estimate for compressed responses without it). Or skip the crawl and send bytes yourself, e.g. the transfer size from DevTools, WebPageTest or har-tools.
Emissions use the Sustainable Web Design model version 4 as implemented by CO2.js (Green Web Foundation): energy per gigabyte for data centres, networks and user devices, operational plus embodied, multiplied by grid carbon intensity — the world average (494 g/kWh) by default, or a country's average with country=VN (or per segment: device_country, network_country, datacenter_country). The result is grams CO2e per view, the SWD digital carbon rating from A+ (≤ 0.040 g) to F (> 0.359 g), and monthly / yearly totals with views (per month). green=true applies the green-hosting factor when your host runs on verified renewable energy (check it at thegreenwebfoundation.org; the API does not look it up).
The page report lists bytes by type, third-party bytes, the largest files and concrete suggestions: oversized images, JPEG / PNG that could be WebP / AVIF, heavy web fonts, third-party and total JavaScript, text files served without compression. It is an estimate: only static HTML is read (no JavaScript execution), so tag managers, lazy-loaded content and video streams are not counted.
Use this in your code
curl "https://apibox.io.vn/v1/web-carbon?bytes=2000000&views=10000&country=VN" \
-H "Authorization: Bearer YOUR_API_KEY"const res = await fetch('https://apibox.io.vn/v1/web-carbon?bytes=2000000&views=10000&country=VN', {
method: 'GET',
headers: {
Authorization: 'Bearer YOUR_API_KEY',
},
});
const data = await res.json();
console.log(data);import requests
res = requests.get(
"https://apibox.io.vn/v1/web-carbon?bytes=2000000&views=10000&country=VN",
headers={"Authorization": "Bearer YOUR_API_KEY"},
timeout=30,
)
print(res.json())<?php
$ch = curl_init('https://apibox.io.vn/v1/web-carbon?bytes=2000000&views=10000&country=VN');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer YOUR_API_KEY'],
]);
$response = curl_exec($ch);
print_r(json_decode($response, true));API documentation → Get a free API key
FAQ
How accurate is it?
It is a model, not a measurement: SWD v4 uses average energy per byte. It is good for comparing pages and tracking change, not for exact carbon accounting.
Does it check green hosting?
Not automatically. Look your host up in the Green Web Foundation directory and pass green=true if it is verified; by default the grid average is used.
Why is my page lighter than in DevTools?
The crawler does not run JavaScript, so scripts loaded later by tag managers, lazy images and videos are missing. Send the DevTools transfer size as bytes for a full figure.