---
title: "Tech Tip #13: Clean code is greener code"
description: "Ordinary refactoring saves 10 to 30% energy, studies report."
url: https://greencode.ai/tech-tips/13-clean-code-is-greener-code/
---

# Tech Tip #13: Clean code is greener code

**Ordinary refactoring saves 10 to 30% energy, studies report.**

[Watch the video](https://media.greencode.ai/shorts/clean-code-is-greener-code-e67aa8ed301e.mp4)

Video created by [explainapaper.com](https://explainapaper.com/?utm_source=greencode.ai&utm_medium=film&utm_campaign=made-by)

### The problem

Quality work is treated as a cost with no visible return. But the structures that make code hard to maintain, like repeated queries, recomputed values and stale dependencies, are often the ones that make it expensive to run.

### The fix you can use today

- Fund quality work (duplication, complexity, missing tests) as part of normal maintenance.
- Track energy alongside quality metrics so the saving is visible.
- Do quality first, then energy-specific optimisation.

Studies of code clean-ups report energy savings of 10 to 30%, before any energy work. GreenCode's climate case is built on this range.

### Tools that help

- [GreenCode Constitution skill](https://greencode-constitution.org/?utm_source=greencode.ai&utm_medium=referral&utm_campaign=greencode) (GreenCode researchers): open-source energy principles and a catalogue of 37 energy anti-patterns that an AI coding agent can follow to find and fix waste like this
- [SonarQube](https://docs.sonarsource.com/sonarqube-server/?utm_source=greencode.ai&utm_medium=referral&utm_campaign=greencode): static analysis for code smells, bugs and security issues, with quality gates in CI
- [Green Metrics Tool](https://github.com/green-coding-solutions/green-metrics-tool?utm_source=greencode.ai&utm_medium=referral&utm_campaign=greencode): measures the energy of whole software scenarios run in containers, so runs can be repeated and compared

### How GreenCode helps

GreenCode helps tackle this by checking a codebase for quality, security and green software patterns in one pass. Wasteful code comes out as a ranked defect, alongside the bugs and security findings. [More on this](https://greencode.ai/feature/sustainability-led-code-quality-assessment/).

### Tags

#code-quality#refactoring#cost

### Sources

- [FAQ: how much energy can optimising software actually save?](https://greencode.ai/faq/)
- [Sustainable code QA and fixes](https://greencode.ai/sustainable-code-qa-and-fixes/)
- [The climate case: 10 to 30% from ordinary code improvement](https://greencode.ai/climate-case/)

[All GreenCode Tech Tips](https://greencode.ai/tech-tips/)

#### Key Facts

- Tip **#13**
- For **CTOs and technical leads**
- Category **Testing, CI and code quality**
- Format **short video**
![GreenCode](https://greencode.ai/wp-content/uploads/2024/12/greencode-logo-website-small-colours-2.webp)

Want this checked on your own system? Talk to the GreenCode team.

[Get in touch](https://greencode.ai/contact/)
