DEV Community

Cover image for From car CO2 to everything CO2: a free carbon calculator API built on official data
Ogn
Ogn

Posted on

From car CO2 to everything CO2: a free carbon calculator API built on official data

Last time I wrote about turning 10.7 million EU car registrations into a vehicle CO2 API. The most common question I got was: "Nice, but what about flights, electricity, fuel and freight?"

So I built that too: the Emission Factors & Carbon Calculator API.

The problem

Every carbon footprint feature needs emission factors, the numbers that turn "500 km of diesel driving" or "1,000 kWh of electricity" into kilograms of CO2e.

Governments publish these for free, but in raw form they're spreadsheets with hundreds of rows, mixed units and yearly format changes. Most developers end up hardcoding a few numbers they found online and hoping they're right.

What the API does

1. Official emission factors, searchable

  • UK DESNZ greenhouse gas conversion factors
  • US EPA GHG Emission Factors Hub
  • Every result includes its source, year and licence, so you have an audit trail

2. Ready-made calculators that send in an activity and get back the CO2e:

  • ⛽ Fuel: litres or kWh of diesel, petrol, gas and more
  • ⚡ Electricity: kWh consumed
  • ✈️ Flights: airport codes in, distance and emissions out
  • 🚚 Freight: tonne-km by road, rail, sea or air
  • 🚗 Vehicles: distance driven by car type
  • 📦 Batch: many calculations in one request

3. Airport utilities: search airports and get the great-circle distance between any two.

What you can build

  • Carbon footprint features for travel, logistics or expense apps
  • Scope 1–3 and ESG reporting tools
  • "CO2 per order" or "CO2 per trip" badges for your product
  • Internal sustainability dashboards

Why not just ask an AI?

Because reporting needs traceable numbers. A language model can give you a plausible guess. This API gives you the official published factor and tells you exactly where it came from.

Try it free

👉 Emission Factors & Carbon Calculator API on RapidAPI: 300 free calls a month.

And if you work with vehicles, the companion Vehicle Specs & CO2 API gives you WLTP CO2 for 137,000+ EU car versions.

Data: UK DESNZ (© Crown copyright, Open Government Licence v3.0), US EPA (public domain) and OurAirports (public domain).

What would you add next: hotels, food, or cloud computing emissions?

Top comments (0)