CometWebCalculation notes

SWDM v4 worked examples

How I calculate a website's carbon footprint

Maciej Zmitrukiewicz · Material for the article Website carbon footprint: estimate, reduce and report it

This is the material behind the article. It shows the SWDM v4 formula the article uses and the examples I check it against. Every input here is made up for illustration, so the results show what the model assigns to a page, while the page's real energy use would need its own measurement.

What I looked at

I took the SWDM v4 coefficients from the Sustainable Web Design methodology and from the constants in CO2.js. The operational coefficients are 0.055, 0.059 and 0.080 kWh/decimal GB for data centres, networks and user devices. Embodied emissions, meaning the making of the hardware, are expressed as energy equivalents of 0.012, 0.013 and 0.081, converted at 494 gCO₂e/kWh. The hosting and reload rules follow the SWDM v4 implementation in CO2.js.

I wrote the arithmetic myself in a short script and didn't run the CO2.js package, so the article has an independent reference point.

D = first-view bytes / 1,000,000,000
F = first-view share + return-view share × reload share

C = F × D × [0.055 × I_dc × (1 - hosting factor)
             + 0.059 × I_network + 0.080 × I_device
             + (0.012 + 0.013 + 0.081) × 494]

The first-view and return shares add up to one. The reload share is the part of the page fetched again on a return visit, the opposite of the cached part. The hosting factor reduces only the operational data-centre emissions. The script applies both adjustments to each component as well, so the components always add up to the total.

Start from cold first-view bytes. If you feed in bytes that already reflect warm caches or weighted visits and then apply the reload share, you count the cache saving twice.

The eight calculation checks

ScenariogCO₂e / modelled viewJSON identifier
1 MB, first view0.148200one_mb_cold
1 MB, hosting factor 10.121030one_mb_hosting_adjustment
1 MB, 50% first / 50% return, 20% reload0.088920one_mb_mixed_visits
Same mixed visits, hosting factor 10.072618one_mb_hosting_and_mixed_visits
2 MB, first view0.296400two_mb_cold
1 MiB (1,048,576 bytes), first view0.155399one_mib_cold
1 MB, data-centre factor 100; other factors 4940.126530one_mb_lower_dc_grid_scenario
Zero input bytes (arithmetic check only)0.000000zero_bytes_model_only

I keep six decimals so the tests catch any change in the arithmetic. In a headline, write about 0.15 gCO₂e.

Where the 0.148200 comes from

For 1 MB, a first-view share of 1, no hosting adjustment and operational factors of 494, the six parts are:

ComponentgCO₂e
data centre operational0.027170
data centre embodied0.005928
network operational0.029146
network embodied0.006422
device operational0.039520
device embodied0.040014
Total0.148200

Intensity and volume

The article compares two made-up periods. 2 MB × 100,000 views gives 29.640 kgCO₂e under this model, and 1 MB × 250,000 views gives 37.050 kgCO₂e. The page got 50% lighter while the total went up by 25%. The example shows how the two numbers relate, and it says nothing about why traffic changed.

Checking it against a second calculator

I also entered the four combinations of first view, cache and hosting into the calculator from CometWeb's own Web Sustainability report and ran it in Chromium. All four gave the same result as the script. Both calculators rest on the same assumptions, so this confirms the arithmetic, while the assumptions themselves stay untested.

What this data can't tell you

Files

To run it again, use Python 3.10 or later with no extra packages and run python3 reproduce.py --output scenarios-reproduced.json --tests-output calculation-tests.json. The script and the JSON record the exact CO2.js file versions I checked the formula against.

Back to the article