A chart showing emissions per AWS region

You can't reduce what you can't measure - Getting started with CodeCarbon

A chart showing emissions per AWS region

You can't reduce what you can't measure - Getting started with CodeCarbon

A chart showing emissions per AWS region

You can't reduce what you can't measure - Getting started with CodeCarbon

Why Measure Your Compute Emissions?

In machine learning, data science, and software engineering, our work increasingly has a real, measurable impact on the environment. Training large models or running experiments at scale consumes energy, and that energy often comes with a carbon cost. Yet, it’s nearly impossible to reduce your emissions if you don’t know where you stand. That’s where CodeCarbon comes in.

CodeCarbon lets you measure the emissions associated with your code so you can make informed, responsible decisions, whether you’re working on a laptop, a server, or a cluster.

How Does CodeCarbon Work?

CodeCarbon estimates your emissions in four main steps:

  • Tracks energy usage: Measures the power consumed by your code on CPU, GPU, and RAM.

  • Finds your location: Automatically detects where your code is running (locally, on-premises, or in the cloud).

  • Calculates emissions: Uses public carbon intensity data for your region to convert energy into kilograms of CO₂ equivalent.

  • Reports results: Gives you clear, actionable feedback and lets you log results for tracking and reporting.

a visualization showing carbon equivalence by region

Why does location matter? Electricity grids vary a lot in carbon intensity. The same computation can emit ten times less CO₂ if run in a region with cleaner energy. The map above shows just how much emissions can differ depending on where your code runs.

Quick Start – Using CodeCarbon in Your Projects

Want to see your code’s carbon impact in seconds? Here’s how to get started:

  1. Install CodeCarbon

  2. Track emissions in your code

    
    

    Or use as a decorator:

    
    
  3. Review your results
    After your run, CodeCarbon will report:

    • Energy consumed (kWh)

    • CO₂ equivalent emitted (kg)

    • Region info and more

a visualization showing amount of carbon generated from a specfic python project

The dashboard above shows not just numbers, but concrete equivalents, like how many miles driven or days of TV watched your emissions represent. This makes your impact real and relatable.


Final Thoughts

You can’t reduce what you can’t measure. CodeCarbon empowers every developer, data scientist, and researcher to understand and reduce their environmental footprint, starting with just a few lines of code.

Want to go a level beyond?

At Pebble, we take this further: we report emissions, energy, and water usage across any environment or framework, at scale, across clusters and clouds. Using Agentic AI, we help teams not only monitor but automatically reduce power, energy, and water usage, unlocking sustainable compute without the manual overhead.

Ready to future-proof your compute? Contact us to learn more.
Or hit the chat in the bottom right now.


We accelerate climate action by empowering businesses to reduce their carbon footprint. Our focus on transparency, accountability, and impact drives progress in carbon offsetting, renewable energy, ocean conservation, and biodiversity protection. Together, we build a sustainable future.

Sign up to our news

MyPebble, Inc.

53 State St. Suite 500

Boston, MA 02109

1-888-314-1019

Sign up to our news

MyPebble, Inc.

53 State St. Suite 500

Boston, MA 02109

1-888-314-1019

Sign up to our news

MyPebble, Inc.

53 State St. Suite 500

Boston, MA 02109

1-888-314-1019