Website Carbon

App · Analytics · 6 actions

Estimate the carbon emissions of web pages with Website Carbon, the keyless API from Wholegrain Digital that powers websitecarbon.com. Give a page's weight in bytes and whether it is on green hosting, and get the CO2e a single visit costs, the page's Digital Carbon Rating from A+ to F, and how it compares with the pages measured across the web. Project that against real traffic for a monthly and yearly footprint, weigh up a move to renewable hosting, rank a set of pages to find what is worth optimizing, price a download or a month of CDN traffic, and fail a build when a page goes over its carbon budget. No account or API key is required.

Actions

ActionWhat it does
Check carbon budgetTest a page against a carbon budget, a minimum Digital Carbon Rating, or both, and get a plain pass or fail to branch on, for a build step, a release check, or a scheduled audit that should raise an alert when a page gets heavier.
Compare hosting optionsPrice the same page on green hosting and on ordinary grid-powered hosting, and get both sides in full (emissions and Digital Carbon Rating for each), plus what switching would save per visit and, if you give the traffic, per year.
Compare pagesRank several pages by emissions, heaviest first, with each page's share of the total, to find which templates on a site are worth optimizing, or to weigh a page against a competitor's. Give each page as the number of bytes it transfers; a URL will not do, because this API estimates from a page's weight rather than visiting it.
Estimate annual emissionsProject a page's emissions across real traffic: give the page weight and how many times it is viewed in a month, and get the monthly and yearly totals in grams, kilograms and tonnes of CO2e, plus the volume of CO2 that represents and what green hosting would have saved over the year.
Estimate data transfer emissionsEstimate the emissions of moving data that is not a page: a file people download, a video stream, an email attachment, or a month of CDN traffic.
Estimate page emissionsEstimate the carbon emissions of a single page load from the page's weight in bytes and whether it is on green hosting.

Check carbon budget

Test a page against a carbon budget, a minimum Digital Carbon Rating, or both, and get a plain pass or fail to branch on, for a build step, a release check, or a scheduled audit that should raise an alert when a page gets heavier. Set at least one of the two: with neither filled in there is nothing to check. When a gram budget is set, the result also says what page weight would meet it and how many bytes the page is over.

Inputs

Page weight (bytes)bytesnumberRequired
How many bytes the page transfers when it loads. Take this from a browser's network panel, a Lighthouse or PageSpeed report, or a CDN log; 1 MB is 1,000,000 bytes.From 1 to 1000000000000000.
Green hostinggreentrue/falseRequired
Whether the page is served from a host running on renewable energy. Green hosting cuts the emissions of the same page by roughly a fifth, so set it deliberately; the Green Web Foundation's checker at thegreenwebfoundation.org/green-web-check will tell you which a domain is. Leave it off if you don't know.Default: false.
Budget (grams of CO2e per visit)max_grams_per_viewnumber
The most CO2e a single visit may cost, in grams. Website Carbon puts the average web page at about 0.36 g; 0.1 g is a demanding target. Leave empty to check the rating only.At least 0.
Minimum ratingmin_ratingtext
The worst Digital Carbon Rating the page may have and still pass, where A+ is the cleanest and F the heaviest. Leave empty to check the gram budget only.One of: A+, A, B, C, D, E, F.

Outputs

bytesnumber
The weight the estimate was worked out for, in bytes.
checksobject
The result of each check that was set.
cleaner_thannumber
The share of web pages this page is cleaner than, as a fraction from 0 to 1 (0.69 means 69%). It is graded on the page's weight alone, so the hosting doesn't change it.
cleaner_than_percentnumber
The same share as a percentage, from 0 to 100.
grams_co2enumber
The grams of CO2e one visit to the page costs. This is the headline figure.
green_hostingtrue/false
True if the estimate is for green hosting, false for ordinary grid powered hosting.
kilobytesnumber
The same weight in kilobytes (1 KB is 1,000 bytes).
kilograms_co2e_per_1000_viewsnumber
The kilograms of CO2e a thousand visits cost.
megabytesnumber
The same weight in megabytes (1 MB is 1,000,000 bytes).
ratingtext
The page's Digital Carbon Rating, from A+ (the cleanest) to F (the heaviest).
rating_descriptiontext
Where that rating sits on the A+ to F scale, in a sentence.
statisticsobject
The figures behind the estimate for one page load: the energy it uses and its emissions on each kind of hosting.
statistics_modeltext
Which calculation model the statistics use: 'Current model' unless an older one was asked for.
within_budgettrue/false
True if the page passes every check that was set.
Example output
{
  "bytes": 1500000,
  "checks": {
    "carbon_budget": {
      "actual_grams_co2e": 0.15630992129445076,
      "bytes_over_budget": 540369,
      "estimated_byte_budget": 959631,
      "estimated_kilobyte_budget": 959.631,
      "headroom_grams_co2e": 0.0,
      "limit_grams_co2e": 0.1,
      "over_by_grams_co2e": 0.0563099,
      "reduction_needed_percent": 36.02,
      "within_budget": false
    },
    "rating": {
      "actual": "C",
      "bands_below_requirement": 1,
      "comparable": true,
      "meets_requirement": false,
      "required": "B"
    }
  },
  "cleaner_than": 0.69,
  "cleaner_than_percent": 69.0,
  "grams_co2e": 0.15630992129445076,
  "green_hosting": false,
  "kilobytes": 1500.0,
  "kilograms_co2e_per_1000_views": 0.15631,
  "megabytes": 1.5,
  "rating": "C",
  "rating_description": "Digital Carbon Rating C: band 4 of 7 on a scale where A+ is the cleanest and F the heaviest.",
  "statistics": {
    "adjusted_bytes": 1132500.0,
    "energy_kwh": 0.0003164168447256088,
    "grid_grams_co2e": 0.15630992129445076,
    "grid_litres_co2": 0.0869395782239735,
    "renewable_grams_co2e": 0.12765310239046812,
    "renewable_litres_co2": 0.07100065554957835
  },
  "statistics_model": "Current model",
  "within_budget": false
}

Compare hosting options

Price the same page on green hosting and on ordinary grid-powered hosting, and get both sides in full (emissions and Digital Carbon Rating for each), plus what switching would save per visit and, if you give the traffic, per year. This is the case for moving a site to a renewable host, in the numbers a decision is made on.

Inputs

Page weight (bytes)bytesnumberRequired
How many bytes the page transfers when it loads. Take this from a browser's network panel, a Lighthouse or PageSpeed report, or a CDN log; 1 MB is 1,000,000 bytes.From 1 to 1000000000000000.
Monthly page viewsmonthly_page_viewsnumber
Optional. How many times the page is loaded in a typical month; supply it to get the yearly saving as well as the per-visit one.From 0 to 1000000000000.

Outputs

bytesnumber
The weight the estimate was worked out for, in bytes.
green_hostingobject
The page priced on green hosting, in full.
kilobytesnumber
The same weight in kilobytes (1 KB is 1,000 bytes).
megabytesnumber
The same weight in megabytes (1 MB is 1,000,000 bytes).
savingsobject
What moving to green hosting saves.
standard_hostingobject
The same page priced on ordinary grid powered hosting, in full.
Example output
{
  "bytes": 1500000,
  "green_hosting": {
    "bytes": 1500000,
    "cleaner_than": 0.69,
    "cleaner_than_percent": 69.0,
    "grams_co2e": 0.12765310239046812,
    "green_hosting": true,
    "kilobytes": 1500.0,
    "kilograms_co2e_per_1000_views": 0.127653,
    "megabytes": 1.5,
    "rating": "B",
    "rating_description": "Digital Carbon Rating B: band 3 of 7 on a scale where A+ is the cleanest and F the heaviest.",
    "statistics": {
      "adjusted_bytes": 1132500.0,
      "energy_kwh": 0.0003164168447256088,
      "grid_grams_co2e": 0.15630992129445076,
      "grid_litres_co2": 0.0869395782239735,
      "renewable_grams_co2e": 0.12765310239046812,
      "renewable_litres_co2": 0.07100065554957835
    },
    "statistics_model": "Current model"
  },
  "kilobytes": 1500.0,
  "megabytes": 1.5,
  "savings": {
    "annual_kilograms_co2e_saved": 17.1941,
    "annual_tonnes_co2e_saved": 0.0171941,
    "grams_co2e_per_view": 0.0286568,
    "monthly_page_views": 50000,
    "percent_reduction": 18.33,
    "rating_change": "C \u2192 B",
    "rating_improves": true
  },
  "standard_hosting": {
    "bytes": 1500000,
    "cleaner_than": 0.69,
    "cleaner_than_percent": 69.0,
    "grams_co2e": 0.15630992129445076,
    "green_hosting": false,
    "kilobytes": 1500.0,
    "kilograms_co2e_per_1000_views": 0.15631,
    "megabytes": 1.5,
    "rating": "C",
    "rating_description": "Digital Carbon Rating C: band 4 of 7 on a scale where A+ is the cleanest and F the heaviest.",
    "statistics": {
      "adjusted_bytes": 1132500.0,
      "energy_kwh": 0.0003164168447256088,
      "grid_grams_co2e": 0.15630992129445076,
      "grid_litres_co2": 0.0869395782239735,
      "renewable_grams_co2e": 0.12765310239046812,
      "renewable_litres_co2": 0.07100065554957835
    },
    "statistics_model": "Current model"
  }
}

Compare pages

Rank several pages by emissions, heaviest first, with each page's share of the total, to find which templates on a site are worth optimizing, or to weigh a page against a competitor's. Give each page as the number of bytes it transfers; a URL will not do, because this API estimates from a page's weight rather than visiting it.

Inputs

Pages (with the bytes each one transfers)pageslistRequired
One row per page. Each row needs the number of bytes that page transfers; a URL will not do, because this API estimates from a page's weight and cannot fetch the page to measure it. Naming a row and marking it as green-hosted are both optional. Up to 20 pages in one step.

Outputs

average_grams_co2enumber
The average grams of CO2e per visit across the pages.
highest_emissionsobject
The page with the highest emissions per visit.
lowest_emissionsobject
The page with the lowest emissions per visit.
page_countnumber
How many pages were compared.
pageslist
Every page, the heaviest emitting first.
total_bytesnumber
The weight of all the pages together, in bytes.
total_grams_co2enumber
Grams of CO2e for one visit to each page, added together.
total_megabytesnumber
The same total weight in megabytes.
Example output
{
  "average_grams_co2e": 0.166325,
  "highest_emissions": {
    "bytes": 2900000,
    "grams_co2e": 0.24679599795490503,
    "green_hosting": true,
    "megabytes": 2.9,
    "name": "Pricing",
    "rating": "D"
  },
  "lowest_emissions": {
    "bytes": 620000,
    "grams_co2e": 0.06460810080170631,
    "green_hosting": false,
    "megabytes": 0.62,
    "name": "Blog post",
    "rating": "A"
  },
  "page_count": 3,
  "pages": [
    {
      "bytes": 2900000,
      "cleaner_than": 0.44,
      "cleaner_than_percent": 44.0,
      "grams_co2e": 0.24679599795490503,
      "green_hosting": true,
      "kilobytes": 2900.0,
      "kilograms_co2e_per_1000_views": 0.246796,
      "megabytes": 2.9,
      "name": "Pricing",
      "rank": 1,
      "rating": "D",
      "rating_description": "Digital Carbon Rating D: band 5 of 7 on a scale where A+ is the cleanest and F the heaviest.",
      "share_of_total_percent": 49.46,
      "statistics": {
        "adjusted_bytes": 2189500.0,
        "energy_kwh": 0.0006117392331361771,
        "grid_grams_co2e": 0.30219918116927147,
        "grid_litres_co2": 0.16808318456634877,
        "renewable_grams_co2e": 0.24679599795490503,
        "renewable_litres_co2": 0.13726793406251817
      },
      "statistics_model": "Current model"
    },
    {
      "bytes": 1800000,
      "cleaner_than": 0.63,
      "cleaner_than_percent": 63.0,
      "grams_co2e": 0.1875719055533409,
      "green_hosting": false,
      "kilobytes": 1800.0,
      "kilograms_co2e_per_1000_views": 0.187572,
      "megabytes": 1.8,
      "name": "Home",
      "rank": 2,
      "rating": "C",
      "rating_description": "Digital Carbon Rating C: band 4 of 7 on a scale where A+ is the cleanest and F the heaviest.",
      "share_of_total_percent": 37.59,
      "statistics": {
        "adjusted_bytes": 1359000.0,
        "energy_kwh": 0.0003797002136707306,
        "grid_grams_co2e": 0.1875719055533409,
        "grid_litres_co2": 0.10432749386876819,
        "renewable_grams_co2e": 0.15318372286856174,
        "renewable_litres_co2": 0.08520078665949403
      },
      "statistics_model": "Current model"
    },
    {
      "bytes": 620000,
      "cleaner_than": 0.89,
      "cleaner_than_percent": 89.0,
      "grams_co2e": 0.06460810080170631,
      "green_hosting": false,
      "kilobytes": 620.0,
      "kilograms_co2e_per_1000_views": 0.0646081,
      "megabytes": 0.62,
      "name": "Blog post",
      "rank": 3,
      "rating": "A",
      "rating_description": "Digital Carbon Rating A: band 2 of 7 on a scale where A+ is the cleanest and F the heaviest.",
      "share_of_total_percent": 12.95,
      "statistics": {
        "adjusted_bytes": 468100.0,
        "energy_kwh": 0.00013078562915325165,
        "grid_grams_co2e": 0.06460810080170631,
        "grid_litres_co2": 0.035935025665909046,
        "renewable_grams_co2e": 0.05276328232139349,
        "renewable_litres_co2": 0.029346937627159054
      },
      "statistics_model": "Current model"
    }
  ],
  "total_bytes": 5320000,
  "total_grams_co2e": 0.498976,
  "total_megabytes": 5.32
}

Estimate annual emissions

Project a page's emissions across real traffic: give the page weight and how many times it is viewed in a month, and get the monthly and yearly totals in grams, kilograms and tonnes of CO2e, plus the volume of CO2 that represents and what green hosting would have saved over the year. A per-visit figure is too small to act on; this is the number a sustainability report or a reduction target is written against.

Inputs

Page weight (bytes)bytesnumberRequired
How many bytes the page transfers when it loads. Take this from a browser's network panel, a Lighthouse or PageSpeed report, or a CDN log; 1 MB is 1,000,000 bytes.From 1 to 1000000000000000.
Green hostinggreentrue/falseRequired
Whether the page is served from a host running on renewable energy. Green hosting cuts the emissions of the same page by roughly a fifth, so set it deliberately; the Green Web Foundation's checker at thegreenwebfoundation.org/green-web-check will tell you which a domain is. Leave it off if you don't know.Default: false.
Monthly page viewsmonthly_page_viewsnumberRequired
How many times the page is loaded in a typical month. The API answers per single visit, and this turns that into the monthly and yearly figures a report or a target is written against.From 0 to 1000000000000.

Outputs

annualobject
The emissions of a year's visits.
annual_page_viewsnumber
Twelve months of those page views.
bytesnumber
The weight the estimate was worked out for, in bytes.
cleaner_thannumber
The share of web pages this page is cleaner than, as a fraction from 0 to 1 (0.69 means 69%). It is graded on the page's weight alone, so the hosting doesn't change it.
cleaner_than_percentnumber
The same share as a percentage, from 0 to 100.
grams_co2enumber
The grams of CO2e one visit to the page costs. This is the headline figure.
green_hostingtrue/false
True if the estimate is for green hosting, false for ordinary grid powered hosting.
hosting_comparisonobject
What the year comes to on each kind of hosting. Empty only if Website Carbon left out its detailed figures.
kilobytesnumber
The same weight in kilobytes (1 KB is 1,000 bytes).
kilograms_co2e_per_1000_viewsnumber
The kilograms of CO2e a thousand visits cost.
megabytesnumber
The same weight in megabytes (1 MB is 1,000,000 bytes).
monthlyobject
The emissions of a month's visits.
monthly_page_viewsnumber
The monthly page views the totals are for.
per_1000_viewsobject
The emissions of every thousand visits.
ratingtext
The page's Digital Carbon Rating, from A+ (the cleanest) to F (the heaviest).
rating_descriptiontext
Where that rating sits on the A+ to F scale, in a sentence.
statisticsobject
The figures behind the estimate for one page load: the energy it uses and its emissions on each kind of hosting.
statistics_modeltext
Which calculation model the statistics use: 'Current model' unless an older one was asked for.
Example output
{
  "annual": {
    "grams_co2e": 93786.0,
    "kilograms_co2e": 93.786,
    "litres_co2": 52163.7,
    "page_views": 600000,
    "tonnes_co2e": 0.093786
  },
  "annual_page_views": 600000,
  "bytes": 1500000,
  "cleaner_than": 0.69,
  "cleaner_than_percent": 69.0,
  "grams_co2e": 0.15630992129445076,
  "green_hosting": false,
  "hosting_comparison": {
    "annual_kilograms_co2e_on_green_hosting": 76.5919,
    "annual_kilograms_co2e_on_grid_hosting": 93.786,
    "annual_kilograms_co2e_saved_by_green_hosting": 17.1941
  },
  "kilobytes": 1500.0,
  "kilograms_co2e_per_1000_views": 0.15631,
  "megabytes": 1.5,
  "monthly": {
    "grams_co2e": 7815.5,
    "kilograms_co2e": 7.8155,
    "litres_co2": 4346.98,
    "page_views": 50000,
    "tonnes_co2e": 0.0078155
  },
  "monthly_page_views": 50000,
  "per_1000_views": {
    "grams_co2e": 156.31,
    "kilograms_co2e": 0.15631,
    "litres_co2": 86.9396,
    "page_views": 1000,
    "tonnes_co2e": 0.00015631
  },
  "rating": "C",
  "rating_description": "Digital Carbon Rating C: band 4 of 7 on a scale where A+ is the cleanest and F the heaviest.",
  "statistics": {
    "adjusted_bytes": 1132500.0,
    "energy_kwh": 0.0003164168447256088,
    "grid_grams_co2e": 0.15630992129445076,
    "grid_litres_co2": 0.0869395782239735,
    "renewable_grams_co2e": 0.12765310239046812,
    "renewable_litres_co2": 0.07100065554957835
  },
  "statistics_model": "Current model"
}

Estimate data transfer emissions

Estimate the emissions of moving data that is not a page: a file people download, a video stream, an email attachment, or a month of CDN traffic. Give the size in megabytes and how many times it is transferred. The page model assumes returning visitors have some of the bytes cached and discounts them; a download has no such discount, so that adjustment is taken back out here and the page-equivalent figure is returned alongside for comparison.

Inputs

Size (MB)megabytesnumberRequired
How large each transfer is, in megabytes (1 MB = 1,000,000 bytes).From 0 to 1000000000.
Green hostinggreentrue/falseRequired
Whether the page is served from a host running on renewable energy. Green hosting cuts the emissions of the same page by roughly a fifth, so set it deliberately; the Green Web Foundation's checker at thegreenwebfoundation.org/green-web-check will tell you which a domain is. Leave it off if you don't know.Default: false.
Number of transferstransfersnumber
How many times the file is transferred (downloads, plays, or sends). Defaults to 1.From 1 to 1000000000000. Default: 1.

Outputs

as_page_viewobject
The same size priced as a page view, for comparison.
bytesnumber
The same size in bytes.
caching_adjustment_removedtrue/false
True if the page model's discount for returning visitors was taken back out. False only when Website Carbon gave no adjusted weight to take it out with, and the figures are then the page view ones.
gigabytesnumber
The same size in gigabytes.
grams_co2e_per_transfernumber
Grams of CO2e for one transfer, with no discount for caching.
green_hostingtrue/false
True if the estimate is for green hosting, false for ordinary grid powered hosting.
megabytesnumber
The size of one transfer, in megabytes.
returning_visitor_factornumber
How many times larger a transfer's emissions are than a page view of the same size, once that discount is taken out (about 1.32).
statisticsobject
The figures behind the estimate for one page load: the energy it uses and its emissions on each kind of hosting.
totalobject
The emissions of every transfer together.
transfersnumber
How many transfers the total is for.
Example output
{
  "as_page_view": {
    "cleaner_than_percent": 3.0,
    "grams_co2e_per_view": 2.6051653549075127,
    "rating": "F"
  },
  "bytes": 25000000,
  "caching_adjustment_removed": true,
  "gigabytes": 0.025,
  "grams_co2e_per_transfer": 3.45055,
  "green_hosting": false,
  "megabytes": 25.0,
  "returning_visitor_factor": 1.3245,
  "statistics": {
    "adjusted_bytes": 18875000.0,
    "energy_kwh": 0.005273614078760147,
    "grid_grams_co2e": 2.6051653549075127,
    "grid_litres_co2": 1.4489929703995583,
    "renewable_grams_co2e": 2.127551706507802,
    "renewable_litres_co2": 1.1833442591596393
  },
  "total": {
    "grams_co2e": 34505.5,
    "kilograms_co2e": 34.5055,
    "tonnes_co2e": 0.0345055
  },
  "transfers": 10000
}

Estimate page emissions

Estimate the carbon emissions of a single page load from the page's weight in bytes and whether it is on green hosting. Returns the grams of CO2e a visit costs, the page's Digital Carbon Rating from A+ to F, the percentage of measured pages it is cleaner than, and the energy and emissions behind those figures.

Inputs

Page weight (bytes)bytesnumberRequired
How many bytes the page transfers when it loads. Take this from a browser's network panel, a Lighthouse or PageSpeed report, or a CDN log; 1 MB is 1,000,000 bytes.From 1 to 1000000000000000.
Green hostinggreentrue/falseRequired
Whether the page is served from a host running on renewable energy. Green hosting cuts the emissions of the same page by roughly a fifth, so set it deliberately; the Green Web Foundation's checker at thegreenwebfoundation.org/green-web-check will tell you which a domain is. Leave it off if you don't know.Default: false.
Calculation modellegacytext
Leave empty. Website Carbon calculates with version 4 of the Sustainable Web Design model; set this only to reproduce a figure published under an older version. It changes the detailed statistics alone, and the headline emissions always use the current model.One of: 2 (Sustainable Web Design version 2 (used until April 2022)), 3 (Sustainable Web Design version 3 (used before version 4)).

Outputs

bytesnumber
The weight the estimate was worked out for, in bytes.
cleaner_thannumber
The share of web pages this page is cleaner than, as a fraction from 0 to 1 (0.69 means 69%). It is graded on the page's weight alone, so the hosting doesn't change it.
cleaner_than_percentnumber
The same share as a percentage, from 0 to 100.
grams_co2enumber
The grams of CO2e one visit to the page costs. This is the headline figure.
green_hostingtrue/false
True if the estimate is for green hosting, false for ordinary grid powered hosting.
kilobytesnumber
The same weight in kilobytes (1 KB is 1,000 bytes).
kilograms_co2e_per_1000_viewsnumber
The kilograms of CO2e a thousand visits cost.
megabytesnumber
The same weight in megabytes (1 MB is 1,000,000 bytes).
ratingtext
The page's Digital Carbon Rating, from A+ (the cleanest) to F (the heaviest).
rating_descriptiontext
Where that rating sits on the A+ to F scale, in a sentence.
statisticsobject
The figures behind the estimate for one page load: the energy it uses and its emissions on each kind of hosting.
statistics_modeltext
Which calculation model the statistics use: 'Current model' unless an older one was asked for.
Example output
{
  "bytes": 12345678,
  "cleaner_than": 0.07,
  "cleaner_than_percent": 7.0,
  "grams_co2e": 1.0506427318758333,
  "green_hosting": true,
  "kilobytes": 12345.7,
  "kilograms_co2e_per_1000_views": 1.05064,
  "megabytes": 12.3457,
  "rating": "F",
  "rating_description": "Digital Carbon Rating F: band 7 of 7 on a scale where A+ is the cleanest and F the heaviest.",
  "statistics": {
    "adjusted_bytes": 9320986.89,
    "energy_kwh": 0.0026042536525055764,
    "grid_grams_co2e": 1.2865013043377547,
    "grid_litres_co2": 0.7155520254726591,
    "renewable_grams_co2e": 1.0506427318758333,
    "renewable_litres_co2": 0.5843674874693384
  },
  "statistics_model": "Current model"
}

On this page