
How To Build a Chrome Extension to Estimate the Carbon Footprint of Your Emails
Have you ever wondered about the carbon footprint of emails?
Calculating the actual value is impossible, as numerous factors are involved, including the energy used to write, send, receive, and store each email on one or more servers, as well as the embodied carbon of all the devices involved in the process.
However, several estimates have been attempted over the years. For example, Mike Berners-Lee counts the footprint to be between 0.03g and 26g of CO2 per single email (read more in this article from the Carbon Literacy Project).
In this tutorial, we’ll show you how to build a Google Chrome extension for Gmail that will generate a live score as users type their emails. The score will be 0-100 and will help users understand if the email they are going to send is “bad”, based on a few simple factors:
- The size in bytes of the email’s body
- the size in bytes of the email’s attachments
- the number of recipients (who will each receive a copy of the original email and attachments being sent)
What You’ll Build
- A floating badge that shows a real-time carbon score while composing emails in Gmail.
- A breakdown panel with scores based on:
- Email body size
- Number of recipients
- Attachment size
- A draggable UI that remembers position across sessions.
- A Chrome Web Store–ready extension package.
You can see the finished product on the Chrome Web Store.
1) Set Up The Project
Create a folder for the Chrome extension, e.g. gmail-carbon-score, with these files (or clone our GitHub Repository):
- manifest.json
- content.js
- icon.png
- style.css (optional)
2) Complete the Manifest File
Edit manifest.json (Chrome Extension Manifest V3):
{
"manifest_version": 3,
"name": "Gmail Carbon Score",
"version": "1.0",
"description": "Estimate the carbon footprint of your emails while composing in Gmail.",
"permissions": [],
"host_permissions": ["https://mail.google.com/*"],
"content_scripts": [{
"matches": ["https://mail.google.com/*"],
"js": ["content.js"],
"run_at": "document_idle"
}],
"icons": {
"128": "icon.png"
}
}
3) Add the Content Script
content.js contains all of the extension’s logic:
- it observes when the Gmail compose window opens
- It monitors body size, recipients, and attachments
- It injects a draggable badge onto the web page
- It calculates and displays the live score
You can get the full version from our GitHub Repository; it’s too long to paste here in full, but it includes:
- MutationObservers for compose detection
- computeScore() for the main score logic
- getRecipientCount() and getAttachmentSizeMb() functions
- Persistent localStorage for UI position
4) Test Locally
Once you have everything set up:- Open Chrome → go to chrome://extensions/
- Enable Developer Mode
- Click “Load unpacked” and select your gmail-carbon-score/ folder
- Open Gmail → Click Compose
- Watch your carbon score update live!

5) Create a Chrome Web Store Developer Account
In order to publish your Chrome Extension you need a developer account.- Visit: chromewebstore.google.com
- Sign in with your Google account
- Pay the one-time developer registration fee
- Go to the Developer Dashboard
6) Prepare Your Extension for Upload
Create a Zip file containing your extension files. On Mac OS, open Terminal and run:
cd gmail-carbon-score/
zip -r -X ../carbon-score.zip . -x "*.DS_Store"
⚠️ This avoids macOS hidden files like __MACOSX that break validation.
Confirm that manifest.json is at the root of the zip.
7) Submit to the Chrome Web Store
- In the Developer Dashboard → click “New Item”
- Upload your ZIP file
- Fill in:
- Title
- Short description
- Full description (include features & benefits)
- Category: Productivity
- At least one 1280×800 screenshot
- Icon: 128×128 PNG
Permissions Justification:
Google require that you give a justifications for the permissions that your extension needs.host_permissions: Access Gmail’s compose window to detect email body size, recipients, and attachments. No personal data is collected or transmitted.
8) Publish and Share
Once your extension is reviewed (usually within 1–3 days), it will be live in the Chrome Web Store. Promote it on:
- Developer forums
- Climate-tech communities
- Your company newsletter
Why It Matters
Every byte of email impacts global energy consumption. This extension provides users with immediate feedback and motivation to send lighter, more efficient messages, triggering a ripple effect that promotes sustainable digital habits.
Have an idea for a digital product?
Are you thinking about creating a software platform or mobile application? We’re here to share our insights and experiences from the front lines of app development. Drop us a message to discover how we can help turn your vision into reality!

