Free every Saturday: the week's 3 best articles. Join →
Subscribe

How to Measure AI Code's Carbon Footprint With Carbonlog

Listen to this articleGreenPlanet News podcastA short audio version of every new article
0:00–:––
All episodes on RSS.com
In this article
    How to Measure AI Code's Carbon Footprint With Carbonlog | GreenPlanet News: Climate, Clean Energy, Green Living How to Measure AI Code's Carbon Footprint With Carbonlog
    Key points
    • Carbonlog is an open-source Claude Code plugin that shows estimated energy use and CO₂ for each AI coding session as you work.
    • For Claude models it applies a PUE of 1.14 and 0.287 kg CO₂e per kWh, so each kWh drawn at the server counts as about 0.33 kg CO₂e.
    • Batch-size assumptions alone can swing an estimate by up to 80%, so treat Carbonlog results as order-of-magnitude guidance, not exact figures.

    The simplest way to measure the carbon footprint of AI-assisted code is to install Carbonlog, an open-source Claude Code plugin from the CNaught team. It estimates the energy use and CO₂ emissions of every coding session as you work and shows the running total inside the coding interface. Nobody outside the AI providers can see their hardware, so any figure is an estimate. Carbonlog is useful because it states its method openly and leans conservative, which means it errs towards overestimating rather than flattering the result. If you want to know what your AI habit costs the climate, you can now get a defensible number in well under a minute of setup.

    What you need before you start

    The kit list is short and costs nothing extra beyond the AI subscription you already use:

    • Claude Code. Carbonlog is built as a plugin for it, so this is where the tracking happens.
    • The Carbonlog plugin. It is open source and made by the CNaught team. Installation takes less than 30 seconds.
    • A place to note results. A simple spreadsheet or notes file is enough if you want to compare sessions over weeks.
    • A sceptical eye. The output is an estimate built on stated assumptions, and you should read it that way.

    Six steps to measure a coding session

    1. Install the plugin. Add Carbonlog to Claude Code. The whole job takes under 30 seconds, so there is no reason to put it off until a "proper" project.
    2. Code as you normally do. Carbonlog tracks the emissions of each API call in the background. Changing your behaviour for the test would defeat the purpose.
    3. Read the running footprint. The call-by-call figures are added up into a total for the session, and that total appears directly inside the coding interface. You see the impact during the work, not weeks later.
    4. Know what sits behind the number. Carbonlog follows a method published by Jegham et al. in 2025. It combines model performance data (the median time to first token and the token generation speed) with the datacenter's power usage effectiveness (PUE) and its carbon intensity. For Anthropic's Claude models, it uses AWS regional parameters: a PUE of 1.14 and 0.287 kg CO₂e per kilowatt-hour.
    5. Do the sums once by hand. As a worked illustration, suppose a session drew 1 kWh at the server. Multiplying by the PUE of 1.14 gives 1.14 kWh at the facility. Multiplying that by 0.287 kg CO₂e per kWh gives about 0.33 kg CO₂e. Doing this once makes the plugin's output feel less like a black box.
    6. Use the summaries. Carbonlog can produce summaries with relatable emissions equivalents, plus breakdowns by project and by model. Compare projects and models over time to see where your usage is heaviest.

    Why every figure is an estimate

    AI providers disclose little about their hardware and infrastructure. Without that information, anyone estimating emissions has to assume things such as server batch size, GPU type and datacenter efficiency. Batch size means how many requests share the energy overhead at the same moment. That one assumption can shift an estimate by as much as 80%.

    Carbonlog handles the gap by building on real-world benchmarks rather than optimistic guesses. It accepts that this may overestimate emissions, in exchange for transparency. The Jegham et al. approach also brings uncertainty ranges and awareness of the infrastructure, which many other tools lack. Those tools often rely on less transparent assumptions or need elaborate setups.

    One limit matters when you read the results. Carbonlog currently gives point estimates, not full uncertainty distributions, and some model parameters are approximated. Use the figures as order-of-magnitude guidance, not as a meter reading.

    Common mistakes when reading AI carbon figures

    • Treating one number as exact. A figure like 0.33 kg per kWh looks precise, but it rests on assumed parameters. Quote it as "roughly" or "about".
    • Comparing with tools that use different assumptions. A tool that assumes heavy batching and one that assumes light batching can disagree by up to 80% on the same session. That reflects their assumptions, not a real difference in usage.
    • Measuring once and stopping. A single session says little. Breakdowns by project and model are where the tracking pays off.
    • Judging the method by how flattering the result is. A conservative method may give a higher number than you expected. That is by design, because the aim is a result you can defend rather than a low one.
    • Forgetting that the method will change. Research on emissions benchmarks is still being updated. CNaught plans to improve Carbonlog as new scholarly data appears and providers disclose more about their infrastructure, so refresh the plugin and re-read your notes from time to time.

    When to bring in a sustainability professional

    For personal curiosity or a small team's own habits, Carbonlog's summaries are enough. Get a specialist involved when the numbers must go into a formal report. Sustainability officers can fold the plugin's project and model breakdowns into a wider greenhouse gas inventory. If the figures support corporate climate commitments or regulatory compliance, a professional should decide how an approximate, point-estimate tool fits into that reporting and how its limits are stated.

    Putting your number in context

    A session footprint tells you about your own usage, and it sits inside a much bigger picture of data centre demand. For that wider view, see our look at how AI's energy use drives data centre power by 2030. If you would like to cut the footprint, not just measure it, our post on the Frugal AI Switchboard of low-emission open-source models is a good next stop. For general steps on limiting AI's energy and water demands, read Countering AI's Energy and Water Consumption.

    Support this blog

    If you are shopping on Amazon anyway, you can start from here: browse home energy saving products on Amazon in your country or visit my Amazon storefront (Amazon Italy).

    As an Amazon Associate I earn from qualifying purchases, at no extra cost to you.

    Sources

    Photo: Daniil Komov / Pexels

    Ciro Simone Irmici
    Who's behind this
    Ciro Simone Irmici

    I'm an Italian creator who builds apps, games and websites. I run GreenPlanet News with the help of AI tools: every article starts from the sources linked above, and I check what goes out. I'm not a doctor, a lawyer or a financial adviser. Spotted a mistake or have an idea? Write to me.

    Instagram @spartaco_94_My websiteWrite to meAbout this blog
    Share this article

    Made by the same author

    Free sites and apps I built. Real tools, no sign-up.

    honesttoolkit.com
    Honest Toolkit

    Free calculators, printable checklists and short guides for money, home, work and fitness.

    • 74 calculators
    • 57 checklists
    • 52 guides
    storiascopio.com
    Storiascopio

    All of history on one line, from the Big Bang to today: the story behind the news, told in a few minutes.

    • 300 events
    • Audio and quiz
    • 5 languages
    atlantedeimiti.com
    Atlas of Myths

    The legends of Italy and the world on a map: goblins, fairies, dragons and saints, region by region.

    • 300 legends
    • On a map
    • Audio stories
    oplaland.com
    Oplaland

    Free learning games, colouring pages and printable worksheets for children, at their own pace.

    • Free
    • No ads
    • For every child

    My books

    I wrote these ebooks. If you buy one, the money goes to me and keeps this blog free.

    My other blogs