We Need to Decarbonize Software

The green software movement is tackling the hidden environmental impact of today’s code

8 min read
An illustration of laptop with flowers coming out of the screen.
Elias Stein
LightGreen

Software may be eating the world, but it is also heating it.

In December 2023, representatives from nearly 200 countries gathered in Dubai for COP28, the U.N.’s climate-change conference, to discuss the urgent need to lower emissions. Meanwhile, COP28’s website produced 3.69 grams of carbon dioxide (CO2) per page load, according to the website sustainability scoring tool Ecograder. That appears to be a tiny amount, but if the site gets 10,000 views each month for a year, its emissions would be a little over that of a one-way flight from San Francisco to Toronto.

This was not inevitable. Based on Ecograder’s analysis, unused code, improperly sized images, and third-party scripts, among other things, affect the COP28 website’s emissions. These all factor into the energy used for data transfer, loading, and processing, consuming a lot of power on users’ devices. Fixing and optimizing these things could chop a whopping 93 percent from the website’s per-page-load emissions, Ecograder notes.

While software on its own doesn’t release any emissions, it runs on hardware in data centers and steers data through transmission networks, which account for about 1 percent of energy-related greenhouse gas emissions each. The information and communications technology sector as a whole is responsible for an estimated 2 to 4 percent of global greenhouse gas emissions. By 2040, that number could reach 14 percent—almost as much carbon as that emitted by air, land, and sea transport combined.

Within the sphere of software, artificial intelligence has its own sustainability issues. AI company Hugging Face estimated the carbon footprint of its BLOOM large language model across its entire life cycle, from equipment manufacturing to deployment. The company found that BLOOM’s final training emitted 50 tonnes of CO2—equivalent to about a dozen flights from New York City to Sydney.

Green software engineering is an emerging discipline consisting of best practices to build applications that reduce carbon emissions. The green software movement is fast gaining momentum. Companies like Salesforce have launched their own software sustainability initiatives, while the Green Software Foundation now comprises 64 member organizations, including tech giants Google, Intel, and Microsoft. But the sector will have to embrace these practices even more broadly if they are to prevent worsening emissions from developing and using software.

What Is Green Software Engineering?

The path to green software began more than 10 years ago. The Sustainable Web Design Community Group of the World Wide Web Consortium (W3C) was established in 2013, while the Green Web Foundation began in 2006 as a way to understand the kinds of energy that power the Internet. Now, the Green Web Foundation is working toward the ambitious goal of a fossil-free Internet by 2030.

Green Software Resources

  • The Green Software Foundation offers a catalog of green software patterns for AI, the cloud, and the Web.
  • The W3C’s Sustainable Web Design Community Group released a draft of its Web sustainability guidelines, with both tactical and technical recommendations for business and product strategy, user-experience design, Web development, and hosting and infrastructure. The draft guidelines also include impact and effort ratings to give software engineers an idea of the level of difficulty in terms of implementation and the level of impact in terms of sustainability.

“There’s an already existing large segment of the software-development ecosystem that cares about this space—they just haven’t known what to do,” says Asim Hussain, chairperson and executive director of the Green Software Foundation and former director of green software and ecosystems at Intel.

What to do, according to Hussain, falls under three main pillars: energy efficiency, or using less energy; hardware efficiency, or using fewer physical resources; and carbon-aware computing, or using energy more intelligently. Carbon-aware computing, Hussain adds, is about doing more with your applications during the periods when the electricity comes from clean or low-carbon sources—such as when wind and solar power are available—and doing less when it doesn’t.

The Case for Sustainable Software

So why should programmers care about making their software sustainable? For one, green software is efficient software, allowing coders to cultivate faster, higher-quality systems, says Kaspar Kinsiveer, a team lead and sustainable-software strategist at the software-development firm Helmes.

These efficient systems could also mean lower costs for companies. “One of the main misconceptions about green software is that you have to do something extra, and it will cost extra,” Kinsiveer says. “It doesn’t cost extra—you just have to do things right.”

Green software is efficient software, allowing coders to cultivate faster, higher-quality systems.

Other motivating factors, especially on the business side of software, are the upcoming legislation and regulations related to sustainability. In the European Union, for instance, the Corporate Sustainability Reporting Directive requires companies to report more on their environmental footprint, energy usage, and emissions, including the emissions related to the use of their products.

Yet other developers may be motivated by the climate crisis itself, wanting to play their part in fostering a habitable planet for the coming generations. And software engineers have tremendous influence on the actual purpose and emissions of what they build.

“It’s not just lines of code. Those lines have an impact on human beings,” says June Sallou, a postdoctoral researcher specializing in sustainable-software engineering at the Delft University of Technology, in the Netherlands. Because of AI’s societal impact in particular, she adds, developers have a responsibility to ensure that what they’re creating isn’t damaging the environment.

Building Greener Websites and Apps

The makers of COP28’s website could have taken a page from directories like Lowwwcarbon, which highlights examples of existing low-carbon websites. The company website of the Netherlands-based Web design and branding firm Tijgerbrood, for instance, emits less than 0.1 grams of carbon per page view.

Creating sustainable websites like Tijgerbrood’s is a team effort that involves different roles—from business analysts who define software requirements to designers, architects, and those in charge of operations—and includes green practices that can be applied at each stage of the software-development process.

Tips for Greener Websites and Apps

First, analysts will have to consider if the feature, app, or software they’re designing should even be developed in the first place. Tech is often about creating the next new thing, but making software sustainable also entails decisions on what not to build, and that may require a shift in mind-set.

The design stage is all about choosing efficient algorithms and architectures. “Think about sustainability before going into the solution—and not after,” says Chiara Lanza, a researcher at the Sustainable AI unit of the Centre Tecnològic de Telecomunicacions de Catalunya, in Barcelona.

During the development stage, programmers need to focus on optimizing code. “We need the overall amount of energy we’re using to run software to go down. Some of that will come from writing [code] efficiently,” says Hannah Smith, a sustainable digital tech consultant and director of operations at the Green Web Foundation.

Tijgerbrood’s website optimized the company’s code by using low-resolution images and modern image formats, loading animations only when a user scrolls them into view, and removing unnecessary code. These techniques help speed up data transfer, loading, and processing on a user’s device. The website also uses minimal JavaScript. “When a user loads a website [with] a lot of JavaScript, it causes them to use a lot more energy on their own device because their device is having to do all the work of reading the JavaScript and running [it],” explains Smith.

When it comes to operations, one of the most impactful actions you can take is to select a sustainable Web hosting or cloud-computing provider. The Green Web Foundation has a tool to check if your website runs on green energy, as well as a directory of hosting providers powered by renewable energy. You can also ask your hosting provider if you can scale how your software runs in the cloud so that peak usage is powered by green energy or pause or switch off certain services during nonpeak hours.

AI the Green Way

Programmers can apply green software strategies when developing AI as well. Trimming training data is one of the major ways to make AI systems greener. Starting with data collection and preprocessing, it’s worth thinking about how much data is really needed to do the job. It may pay to clean the dataset to remove unnecessary data, or select only a subset of the dataset for training.

“The larger your dataset is, the more time and computation it will take for the algorithm to go through all the data,” hence using up more energy, says Sallou.

For instance, in a study of six different AI algorithms that detect SMS spam messages, Sallou and her colleagues found that the random forest algorithm, which combines the output of a collection of decision trees to make a prediction, was the most energy-greedy algorithm. But reducing the size of the training dataset to 20 percent—only 1,000 data points out of 5,000—dropped the energy consumption of training by nearly 75 percent, with only a 0.06 percent loss in accuracy.

Choosing a greener algorithm could also save carbon. Tools like CodeCarbon and ML CO2 Impact can help make the choice by estimating the energy usage and carbon footprint of training different AI models.

Tips for Greener AI

Tools for Measuring Software’s Carbon Footprint

To write green code, developers need a way of measuring the actual carbon emissions across a system’s entire life cycle. It’s a complex feat, given the myriad processes involved. If we take AI as an example, its life cycle encompasses raw material extraction, materials manufacturing, hardware manufacturing, model training, model deployment, and disposal—and not all of these stages have available data.

“We don’t understand huge parts of the ecosystem at the moment, and access to reliable data is tough,” Smith says. The biggest need, she adds, is “open data that we can rely on and trust” from big tech data-center operators and cloud providers like Amazon, Google, and Microsoft.

Until that data surfaces, a more practical approach would be to measure how much power software consumes. “Just knowing the energy consumption of running a piece of software can impact how software engineers can improve the code,” Sallou says.

Developers themselves are heeding the call for more measurement, and they’re building tools to meet this demand. The W3C’s Sustainable Web Design Community Group, for instance, plans to provide a test suite to measure the impacts of implementing its Web sustainability guidelines. Similarly, the Green Software Foundation wrote a specification to calculate the carbon intensity of software systems. For accurate measurements, Lanza suggests isolating the hardware in which a system runs from any other operations and to avoid running any other programs that could influence measurements.

Other tools developers can use to measure the impact of green software engineering practices include dashboards that give an overview of the estimated carbon emissions associated with cloud workloads, such as the AWS Customer Carbon Footprint Tool and Microsoft’s Azure Emissions Impact Dashboard; energy profilers or power monitors like Intel’s Performance Counter Monitor; and tools that help calculate the carbon footprint of websites, such as Ecograder, Firefox Profiler, and Website Carbon Calculator.

Green Software Measurement Tools 

Developers can use these tools to measure the impact of green software engineering practices.

AI

Estimate the energy usage and carbon footprint of training AI models with these tools.

carbontracker
experiment-impact-tracker
ML CO2 Impact

Cloud

These dashboards give an overview of the estimated carbon emissions associated with cloud workloads.
AWS Customer Carbon Footprint Tool
Google Cloud Carbon Footprint
Microsoft Azure Emissions Impact Dashboard
Cloud Carbon Footprint (free, open source, provider agnostic)

Code

Integrate emissions estimation at the code level using these tools.
Carbon-Aware SDK
CodeCarbon
Impact Framework

Middleware

These energy profilers or power monitors provide APIs (application programming interfaces) to measure power consumption of apps or track energy metrics of processors.
Intel’s Performance Counter Monitor
PowerAPI

Web

These tools help calculate the carbon footprint of websites.
Are my third parties green?
CO2.js
Ecograder
Firefox Profiler
Website Carbon Calculator

The Future Is Green

Green software engineering is growing and evolving, but we need more awareness to help the discipline to become more widespread. This is why, in addition to its Green Software for Practitioners course, the Green Software Foundation aims to create more training courses, some of which may even lead to certifications. Likewise, Sallou coteaches a graduate course in sustainable software engineering, whose syllabus is open and can be used as a foundation for anyone looking to build a similar course. Providing this knowledge to students early on, she says, could ensure they bring it to their workplaces as future software engineers.

In the realm of artificial intelligence, Navveen Balani, an AI expert and Google Cloud Certified Fellow who also serves on the Green Software Foundation’s steering committee, notes that AI could inherently include green AI principles in the coming years, much like how security considerations are now an integral part of software development. “This shift will align AI innovation with environmental sustainability, making green AI not just a specialty but an implied standard in the field,” he says.

As for the Web, Smith hopes the Green Web Foundation will cease to exist by 2030. “Our dream as an organization is that we’re not needed, we meet our goal, and the Internet is green by default,” she says.

Kinsiveer has observed that in the past, software had to be optimized and built well because hardware then was lacking. As hardware performance and innovation leveled up, “the quality of programming itself went down,” he says. But now, the industry is coming full circle, going back to its efficiency roots and adding sustainability to the mix.

“The future is green software,” Kinsiveer says. “I cannot imagine it any other way.”

The Conversation (8)
Roberto Andrich
Roberto Andrich02 Apr, 2024
M

The impact of CO2 on climate change is a very controversial theme.

CO2 is the gas of life. Many scientists says (ex.: Freeman Dyson) that CO2 is making the earth greener. CO2 is food for the plants. Also the climate alarmism is causing the increase of the energy costs that is making the situation in developing countries even worst. I am totally against pollution. I think we must fight pollution, but C02 is not a polluting gas

See the opinion of Dr. Judith Curry, Dr.Richard Lindzen and the greenpeace founder Patrick Moore about it.

1 Reply
Mithlesh Kumar
Mithlesh Kumar01 Apr, 2024
M

That's is a new prospect to look at things, but I doubt whether we really care this.I have never seen an article on CO2 emission due to nonsense wars/conflicts going all around.We tend to account the incremental CO2 emission but close our eyes to the giant ones.

Brian Bishop
Brian Bishop28 Mar, 2024
SM

I can't take this article seriously without a discussion on how much energy Bitcoin mining takes.