How We Built Carbon Badge: A Website Carbon Calculator
Every website has a carbon footprint. Every page load consumes energy across data centers, networks, and end-user devices. Most site owners have no idea how much.
We built Carbon Badge to make website carbon emissions visible and actionable.
The Problem
Website sustainability is growing in importance:
- The internet accounts for roughly 3.7% of global carbon emissions
- An average web page produces about 0.5g CO2 per pageview
- EU regulations are pushing digital sustainability requirements
But measuring website carbon is surprisingly complex. There was no simple tool that combined accurate calculations with an embeddable badge.
How It Works
The Sustainable Web Design Model (SWDM v4)
We use the latest SWDM v4 methodology from the Sustainable Web Design community:
// Energy intensity: 0.194 kWh per GB transferred
// Split: Data Center (0.055) + Network (0.059) + Device (0.080)
define('SWDM_KWH_PER_GB', 0.194);
define('SWDM_GRID_INTENSITY', 494); // gCO2/kWh world average
The calculation considers:
- Page weight — Total bytes transferred (HTML, CSS, JS, images, fonts)
- Energy per byte — Using SWDM v4 coefficients for DC, network, and device
- Grid carbon intensity — 494 gCO2/kWh global average
- Green hosting — Reduced factor if hosted on renewable energy (checked via Green Web Foundation API)
Grading System
| Grade | CO2 per pageview |
|---|---|
| A | < 0.15g |
| B | < 0.30g |
| C | < 0.50g |
| D | < 0.75g |
| E | < 1.00g |
| F | > 1.00g |
The Embeddable Badge
Sites can embed a carbon badge showing their grade:
<a href="https://carbon-badge.com">
<img src="https://carbon-badge.com/api/badge/yourdomain.com"
alt="Carbon Badge" width="140" height="40">
</a>
The badge updates automatically every 24 hours.
Technical Stack
- PHP 8.1 + MySQL on o2switch
- Cloudflare for DNS and CDN
- Green Web Foundation API for green hosting verification
- Stripe for Pro/Business/Enterprise plans
- Cookie consent with conditional GA4 loading
Performance
Practicing what we preach:
- Full security headers (HSTS preload, CSP, X-Frame-Options)
- Dark theme (lower energy on OLED screens)
- Minimal JavaScript
- Schema.org markup (WebSite, Organization, SoftwareApplication, FAQPage)
Pricing Model
- Free: 3 scans/day, 1 page per scan
- Pro (9 EUR/mo): 50 scans/day, embeddable badge, monitoring
- Business (29 EUR/mo): 500 pages/scan, API access, 5 sites
- Enterprise (79 EUR/mo): Unlimited everything
Content Strategy
16 articles covering:
- Website carbon calculation methodology
- Green hosting explained
- Reducing website carbon footprint
- CSRD digital sustainability requirements
- Industry benchmarks
Lessons
- The SWDM methodology is well-documented but translating it into code required careful attention to units
- Green Web Foundation's API is excellent — free, fast, well-maintained
- Dark themes aren't just aesthetic — they reduce energy consumption on OLED devices
- Badge mechanics drive viral growth — each badge is a backlink and brand impression
Try it: Carbon Badge — Free website carbon calculator with embeddable sustainability badge.
Top comments (0)