Martina Đođo

Coding, Sustainability, Performance, Good practices

As developers, we wield immense power to shape a greener digital landscape. Every digital interaction and decision we make contributes to the Internet’s CO2 emissions, from the websites and apps we build in frameworks we choose, to the servers that power them.

Sustainability guide for developers

Developers can help mitigate this impact by adopting coding practices that enhance website performance, reduce energy consumption and contribute to a greener Internet. This guide for developers will give you an introduction in how to use your skills to help push our industry towards more sustainable production.

Let’s begin with the facts: the Internet hosts over 1.9 billion websites as of 2024, with this number steadily growing. The energy required to sustain these websites, often derived from non-renewable sources, contributes to carbon emissions and exacerbates climate change. 

It is estimated that by 2025 the IT industry could use 20% of all produced electricity, and emit up to 5.5% of the world’s carbon emissions. Given this scale, even minor enhancements in website efficiency can yield substantial reductions in CO2 emissions.*

Sustainability guide for developers
On Global Electricity Usage of Communication Technology: Trends to 2030, Andrae & Edler (2015)

Clean code strategies for reducing energy consumption

To achieve greener websites, developers should prioritize clean and smart code. While it may appear to be the industry standard to adopt clean, cutting-edge coding practices, that’s frequently not the case. In a fast-paced working environment things are sometimes done just so you can check them off of an ever-growing to-do list, and code reviews are done only for the interns. This results in all kinds of chaotic code that is hard to maintain or change. Let’s be honest – we’ve all found ourselves in that situation at some point.

So, it’s not unnecessary to remember that clean coding involves writing concise, well-structured code that minimizes processing demands, resulting in faster load times and reduced energy consumption. Strategies include:

  • eliminating all redundant and unused code on a regular basis
  • optimizing images and other media files
  • serving images in webp format
  • strategically loading content: preloading fonts and lazy-loading images
  • utilizing modern web technologies such as CSS Grid and Flexbox for efficient layouts
  • minifying JS and CSS output
  • using modern, fast and lightweight frameworks 

Combine clean code with smart serving

Caching plays a crucial role in website optimization. By leveraging browser and server-side caching mechanisms, developers can decrease server load and enhance user experience. Caching reduces the number of requests sent to servers, leading to quicker load times for returning visitors and lower energy consumption. This demonstrates the symbiotic relationship between performance optimization and environmental sustainability.

Content Delivery Networks (CDNs) offer another avenue for efficiency gains. By distributing website assets across a global network of servers, CDNs minimize latency and improve load times for users worldwide. Because it serves content from servers closer to end users, this optimization reduces the energy required for data transmission over long distances.

Always think green – prioritize sustainability throughout the development cycle

In addition to these strategies, adopting a sustainability mindset is paramount. Developers should prioritize sustainability throughout the development lifecycle, from initial design to ongoing maintenance. Regular code reviews, performance testing, and continuous optimization are essential practices for building greener websites and achieving greener performance scores. 

Developers wield immense power to shape a greener digital landscape. By implementing performance optimization techniques, minimizing energy consumption, and prioritizing sustainability, we can create websites that not only excel in user experience but also contribute positively to the environment. Let’s commit to building a more sustainable internet – one website at a time.