Calculator API

Use Our Calculators in Your Own Software

Send a request, get the carbon result back as data. The API runs the same calculations as this website, so the numbers always match.

How it works

Three steps, no sign-up

  1. You ask

    Your software requests a web address (a link) that includes your details, for example the website you want measured or the answers to the personal questions.

  2. We calculate

    Our server runs the same calculator as the pages on this site and works out the emissions in kg or grams of CO2-e.

  3. You get data back

    The reply is JSON, a simple text format that every programming language can read. Show it, store it, or feed it into your own reports.

Free for now, with fair-use limits

You don't need a key or an account. To stop the service being overloaded, each internet address can make 20 website requests an hour (each one runs a real page test) and 300 requests an hour to each of the other calculators. Go over and you get a 429 reply with a Retry-After header. Access terms may change in future. If you plan to use the API at volume, get in touch first.

Reference

The four calculators

All requests are GET requests, so you can try any of them by clicking the example link or pasting it into a browser. Replies use kg or grams of CO2-e and are never cached.

GET/api/v1/calculators/website-carbon

Measures a live web page the way a visitor on a phone would load it, then works out emissions per page view and per year, split into data centre, network and the visitor's device.

Website carbon parameters
ParameterNeeded?What to send
urlYesThe page to measure, for example www.example.com
monthly_viewsNoPage views a month, a whole number. Default 10,000.

Example request

GET https://www.web-zero.co.uk/api/v1/calculators/website-carbon?url=www.example.com&monthly_views=10000

A test can take up to a minute. Results for the same page are kept for 30 minutes.

The comparison block is the red/green rating the website shows. Each of page_weight, per_view and annual is below_average (green, at or below) or above_average (red) against the Sustainable Web Design project's global average page (2.4 MB, HTTP Archive June 2023), whose figures for this calculator are in benchmark. performance.status is Google Lighthouse's own band: good (90 to 100), needs_improvement (50 to 89) or poor (0 to 49). hosting.status is green, not_green or unknown.

Example reply (for a 1.12 MB page)

{
  "url": "https://www.example.com/",
  "monthly_page_views": 10000,
  "page_weight_mb": 1.12,
  "performance_score_mobile": 87,
  "green_hosting": {
    "known": true,
    "green": true,
    "provider": "Example Hosting Ltd"
  },
  "per_view_g": {
    "total": 0.0953,
    "data_centre": 0.0047,
    "network": 0.028,
    "visitors_device": 0.0626
  },
  "share_percent": {
    "data_centre": 4.9,
    "network": 29.4,
    "visitors_device": 65.7
  },
  "annual_kg": 11.44,
  "equivalents_per_year": {
    "car_miles": 44,
    "kettles_boiled": 582,
    "london_paris_flights": 0.26,
    "uk_household_days": 12.8
  },
  "comparison": {
    "benchmark": {
      "name": "Sustainable Web Design global average page",
      "page_kb": 2419.57,
      "per_view_g": 0.2521,
      "annual_kg": 30.26,
      "published_per_view_g": 0.36,
      "source": "sustainablewebdesign.org/digital-carbon-ratings (HTTP Archive crawl of 1 June 2023)",
      "note": "per_view_g and annual_kg are the average page worked out with this calculator's own model, without green hosting"
    },
    "page_weight": {
      "kb": 1120.0,
      "status": "below_average"
    },
    "per_view": {
      "g": 0.0953,
      "status": "below_average"
    },
    "annual": {
      "kg": 11.44,
      "status": "below_average"
    },
    "performance": {
      "score": 87,
      "status": "needs_improvement"
    },
    "hosting": {
      "status": "green"
    }
  },
  "measured_at": "2026-09-25T14:03:00+00:00",
  "...": "and a method block"
}

GET/api/v1/calculators/email-footprint

Annual footprint of an inbox: your device, network transmission and server storage.

Email footprint parameters
ParameterNeeded?What to send
storedNoEmails stored in the inbox. Default 5,000.
receivedNoEmails received a month. Default 300.
sent_basicNoPlain emails sent a month. Default 100.
sent_attachmentsNoEmails with attachments sent a month. Default 20.
minutes_per_dayNoMinutes a day spent on email. Default 60.

Example request

GET https://www.web-zero.co.uk/api/v1/calculators/email-footprint?stored=5000&received=300&sent_basic=100&sent_attachments=20&minutes_per_day=60

Try it

Example reply

{
  "inputs": {
    "stored": 5000,
    "received": 300,
    "sent_basic": 100,
    "sent_attachments": 20,
    "minutes_per_day": 60
  },
  "annual_g": {
    "your_device": 1440.56,
    "network_transmission": 1.323,
    "server_storage": 0.968,
    "total": 1442.851
  },
  "annual_kg": 1.443,
  "share_percent": {
    "your_device": 99.8,
    "network_transmission": 0.1,
    "server_storage": 0.1
  },
  "equivalents_per_year": {
    "car_miles": 5.5,
    "kettles_boiled": 73,
    "uk_household_days": 1.61
  },
  "...": "and assumptions and method blocks"
}

GET/api/v1/calculators/devices-services

Annual footprint of the devices and services you use, split into manufacturing and energy use.

Devices and services parameters
ParameterNeeded?What to send
itemsYesA comma-separated list of name:number. A bare name means one. Services are always one.

Devices: smartphone, laptop, monitor, desktop, tv, console, tablet, voice-assistant, router, smart-lamp, printer, smartwatch, vr-headset, home-server. Services: broadband, music-streaming, video-conference, mobile-video-conference, online-storage, e-scooter, search-engine, ai-text, ai-video. The list, with figures for each, is at /api/v1/calculators/devices-services/catalogue.

Example request

GET https://www.web-zero.co.uk/api/v1/calculators/devices-services?items=laptop,smartphone,broadband

Try it

Example reply

{
  "items": [
    {
      "key": "laptop",
      "name": "Laptop",
      "kind": "device",
      "quantity": 1,
      "production_kg": 62,
      "use_kg": 4.98,
      "total_kg": 66.98,
      "assumes": "5 hours a day, kept 5 years"
    },
    {
      "key": "smartphone",
      "name": "Smartphone",
      "kind": "device",
      "quantity": 1,
      "production_kg": 40,
      "use_kg": 1.44,
      "total_kg": 41.44,
      "assumes": "in use all day, kept 2.5 years"
    },
    "..."
  ],
  "total_kg_year": 108.8,
  "production_kg_year": 102,
  "use_kg_year": 6.8,
  "biggest": "Laptop",
  "equivalents_per_year": {
    "car_miles": 418,
    "kettles_boiled": 5539,
    "uk_household_days": 121.3
  }
}

GET/api/v1/calculators/personal-carbon

A personal footprint from 13 answers, with a breakdown by category and the biggest sources. Every question is needed, and each answer is one of the keys below. The full list with the figures behind each answer, and the source of every factor, is at /api/v1/calculators/personal-carbon/questions.

Personal carbon parameters
ParameterQuestionAnswer keys
beefHow often do you eat beef?never, monthly, weekly, several
chicken_porkHow often do you eat chicken or pork?never, monthly, weekly, most-days
dairyHow much dairy (milk, cheese, yoghurt) do you have?none, occasional, daily, high
food_wasteHow much food do you throw away?low, moderate, high, very-high
carHow much do you travel by car?never, occasional, weekly, daily
flightsHow much do you fly?none, one-short, two-to-four, five-plus
public_transportHow often do you use public transport (bus, coach or train)?never, rarely, weekly, daily
householdHow many people live in your home?1, 2, 3, 4, 5-plus
electricityHow much electricity does your home use?low, moderate, high, very-high
heatingHow is your home heated?renewable, electric, gas, oil-coal
clothingHow many new items of clothing do you buy?rare, moderate, frequent, very-frequent
electronicsHow many new electronic devices (phone, tablet or laptop) do you buy?rare, moderate, frequent, very-frequent
recyclingHow much of your household waste do you recycle?excellent, good, average, none

Example request

GET https://www.web-zero.co.uk/api/v1/calculators/personal-carbon?household=2&beef=weekly&chicken_pork=weekly&dairy=daily&food_waste=moderate&car=weekly&flights=one-short&public_transport=weekly&electricity=moderate&heating=gas&clothing=moderate&electronics=rare&recycling=average

Try it

Example reply

{
  "total_kg_co2e_year": 5286.3,
  "total_tonnes_co2e_year": 5.29,
  "categories": [
    {
      "key": "food",
      "name": "Food and diet",
      "kg_co2e_year": 2115.1,
      "percent": 40.0
    },
    {
      "key": "transport",
      "name": "Transport",
      "kg_co2e_year": 1726.9,
      "percent": 32.7
    },
    {
      "key": "home",
      "name": "Home energy",
      "kg_co2e_year": 1062.4,
      "percent": 20.1
    },
    {
      "key": "consumption",
      "name": "Shopping",
      "kg_co2e_year": 370.7,
      "percent": 7.0
    },
    {
      "key": "waste",
      "name": "Waste",
      "kg_co2e_year": 11.3,
      "percent": 0.2
    }
  ],
  "biggest": {
    "question": "Beef",
    "answer": "Weekly",
    "kg_co2e_year": 1327.8
  },
  "items": [
    {
      "key": "beef",
      "category": "food",
      "category_name": "Food and diet",
      "question": "Beef",
      "answer": "Weekly",
      "amount": 20,
      "unit": "kg a year",
      "factor": 66.39,
      "factor_name": "Beef",
      "shared_by": 1,
      "kg_co2e_year": 1327.8,
      "percent": 25.1
    },
    "..."
  ],
  "equivalents_per_year": {
    "car_miles": 20332,
    "london_paris_flights": 122,
    "uk_household_days": 5893
  },
  "...": "and a method block"
}

Using it

Examples in code

curl

curl "https://www.web-zero.co.uk/api/v1/calculators/email-footprint?stored=5000&minutes_per_day=60"

Python

import requests

r = requests.get("https://www.web-zero.co.uk/api/v1/calculators/email-footprint",
                 params={"stored": 5000, "minutes_per_day": 60}, timeout=30)
r.raise_for_status()
print(r.json()["annual_kg"], "kg CO2-e a year")

JavaScript

const r = await fetch("https://www.web-zero.co.uk/api/v1/calculators/email-footprint?stored=5000&minutes_per_day=60");
const data = await r.json();
console.log(data.annual_kg, "kg CO2-e a year");

If something goes wrong

A failed request returns a status code and a JSON message, for example {"error": "..."}, that says what to fix.

Status codes
CodeMeaning
200It worked. The reply is the result.
422Something you sent is missing or not valid. The message says which.
429Too many requests from your address. Wait for the time in Retry-After.
502 or 503The website you asked us to measure could not be tested, took too long, or the measuring service is busy. Try again in a minute.

Where the figures come from

Every calculator's page explains its method under "Understanding your results". The website calculator uses Web Zero's Website Audit Methodology with Google PageSpeed Insights and The Green Web Foundation. Email and devices use Web Zero's Digital Operations method and UK grid figures (DESNZ 2026). The personal calculator uses UK Government conversion factors, with Our World in Data for food, and every factor and source is in its question list.

Planning to build on the API?

Tell us what you are building and how many requests you expect. We would like to hear about it.