Create sustainable websites

The web is not a “clean thing”. Every page view consumes resources, and in its current form the web is not sustainable. But we have many opportunities to improve the way we build digital services, and web development, too, can reduce our ecological footprint.

This doesn’t have to be an added burden. Instead, it can be a reason to rethink how we approach accessibility, personal data and fair business models. For most people, the ecological footprint of the digital world remains intangible. It is hard to imagine in a clean office, but the Internet is a pretty dirty business.

According to a study by GreenIT.fr, the annual footprint of the digital world is made up of:

  • 6,800 TWh of primary energy

  • 1,400 million t of greenhouse gases

  • 7.8 million m³ of fresh water

  • 22 million t antimony equivalent, a measure of the depletion of non-renewable resources

Measured against humanity’s total footprint, this gives the digital world the following shares:

  • 4.2 % of primary energy consumption

  • 3.8 % of greenhouse gas emissions

  • 0.2 % of water consumption

Most of the web’s CO₂ emissions come from electricity consumption.

As we use more and more data in our daily lives, the Internet’s electricity consumption is rising rapidly. It may be out of sight and out of mind, but it leaves an enormous CO₂ footprint.

It doesn’t have to stay that way. So I asked myself how design and web development can help make the web more energy efficient. My answer is a practical list of the most important things you can do to avoid wasting energy and make your websites as energy efficient as possible. Almost everything on it also improves performance and user experience.

General principles for good power consumption

What consumes electricity? On mobile devices, most of the energy goes to a few main components:

  • CPU (main processor)

  • GPU (graphics processor)

  • Networks (WLAN and cellular chips)

  • Screen

The system adjusts CPU and GPU performance to the tasks currently in hand. It does this by switching individual components on or off and by changing their clock frequency. These tasks include rendering the websites that users interact with in the browser, and other applications that display web content.

Roughly speaking, the more performance the chips have to deliver, the lower their energy efficiency. The hardware can ramp up to high performance for a short time, although this costs a lot of electricity. It then quickly switches back to a more efficient state with lower power consumption.

1. Design & content

When we talk about the energy efficiency of websites, it is easy to assume that it is a purely technical issue. Yet efficiency can be improved before a website is even built, because design and content have a big impact on it. The following areas are worth thinking about.

1.1 SEO

At first glance, search engine optimisation (SEO) may seem to have nothing to do with website efficiency. In practice, though, the two goals are closely linked. When we optimise a website for search engines, we help people find the information they need quickly and easily.

When SEO succeeds, people spend less time searching the Internet and visit fewer sites that don’t meet their needs. This saves energy, and the energy that is still consumed goes into something of real use to them.

1.2 Writing texts

Like SEO, copywriting affects the efficiency of a website, because it influences how long people stay on it. Sometimes we want people to spend a lot of time on a website and immerse themselves in our content.

What we don’t want is for users to waste their time digging through content that offers them little or nothing. Clear, efficient copy saves that time, and with it energy.

1.3 Choose fonts carefully

Web fonts can make a website more attractive, but they can also add a lot of loading time. A single font file can be up to 250 kilobytes in size, and another style such as “Bold” can add another 250 KB.

To reduce the load from custom web fonts, designers can consider these options:

  • Use system fonts if possible. They are not always as pretty, but fonts such as Arial and Times New Roman are already on the device, so no font file has to be loaded at all.

  • Use fewer font variations. If you want to use custom web fonts, be sparing with the number of typefaces and weights.

1.4 User experience (UX)

At its core, a good user experience (UX) reduces friction on the way through a website. We want people to find what they are looking for and to do what they need to do as efficiently as possible. A good user experience makes the web easier and more pleasant for everyone, and in turn reduces the energy wasted on navigating pages. The longer it takes us to decode a page, the more energy we use on it. Good user guidance shortens this “decoding time” and so reduces energy consumption.

1.5 Reduce images

On most websites, images make up the largest share of the data downloaded. The more images there are and the larger their files, the more data has to be transferred and the more energy is used. Whatever the technical optimisations, content creators should think carefully about which images they use:

  • Does the image genuinely give users something?

  • Does it convey useful information?

  • Could the same effect be achieved with a smaller image?

  • Can we do without images that users never see, for example in carousels?

  • Could you achieve the same effect with a vector graphic (or even a CSS style) instead of a photo?

If you ask yourself these questions and use images as sparingly as you can without hurting usability, you keep energy consumption low.

1.6 Reduce videos

Videos are less common than images, but they are becoming increasingly popular on the web, and they are by far the most data- and processing-intensive form of content. As with images, ask yourself whether a video is really necessary. If it is, see how you can reduce the amount of streamed video, for example by doing without autoplay and keeping videos short.

In terms of page weight, a website that plays videos can be one or even two orders of magnitude larger than one without. It also puts a much higher load on the CPU of the user’s device, which leads to considerably higher energy consumption.

1.7 Use dark mode

Many years ago, dark websites were one of the first popular techniques for saving energy on the web. They disappeared with the arrival of LCD screens, which, unlike CRT screens, have a permanent backlight and use the same energy whatever colour is on the screen.

Only with OLED screens, which light each pixel individually, have darker colours once again become a viable way to save energy on end-user devices. There are many browser add-ons that enable a “dark mode”, turning the light colours of a web page into dark ones. Today, dark mode is standard in many system settings.

1.8 Reduce loops

Use animated content, such as animated images and auto-playing videos, sparingly. Avoid loading spinners as GIFs and CSS animations that keep redrawing even when they are not visible.

2. Website development

Developers have a major influence on the energy efficiency of the websites they build and maintain. Some decisions lie with designers and content creators. In several areas, though, developers have full control, and in others they can still refine the content and designs they receive.

It is fine for a page to use energy while users are interacting with it. After all, they want it to load fast and respond quickly to touch. In many cases, the same optimisations that shorten the time to first frame and to first interaction also reduce power consumption. Be careful, however, about loading resources and running scripts after the initial page load. The goal is to return to idle as soon as possible. In general, the less JavaScript runs, the more power-efficient the page, because every script adds to the work the browser has already done to lay out and display the page.

Once the page has loaded, interactions such as scrolling and typing drive up hardware power, mainly that of the CPU and GPU. That makes sense, but make sure the hardware goes back to idle as soon as users stop. Also try to stay on the browser’s “fast paths”: normal scrolling, for example, is much more power-efficient than custom scrolling built in JavaScript.

2.1 Writing efficient code

This probably goes without saying, but tidy, concise code is a good thing. Keep your code clean and simple, avoid duplication and write efficient queries.

Remember that this applies not only to the code you write, but also to the code you include. If you use existing frameworks and libraries, make sure they are refined and adapted to deliver the functionality you need efficiently. There is no need to take a sledgehammer to crack a nut.

If you use a CMS such as WordPress, avoid unnecessary plugins that bloat the system. Choose plugins that keep the server load low and don’t weigh down the front end.

2.2 Use less JavaScript

JavaScript (JS) affects website efficiency in two ways: it adds file weight to the page, and it increases the processing the user’s device has to do. The second applies to JS much more than to other types of files.

Functions controlled by JS run on the user’s computer or phone. There they increase CPU usage, which in turn increases the device’s power consumption. Can you hear the fans whirring on your laptop? That is energy being wasted.

Look for ways to build front-end interactions, functions and animations with more efficient technologies such as CSS, or at least use JS efficiently. Tracking and advertising scripts deserve a special mention. They rarely give users anything, but they can add a lot of data, cause heavy CPU usage, slow websites down and invade users’ privacy.

2.3 Optimise images

As mentioned above, images are one of the biggest sources of data traffic. Besides the decisions designers and content creators make about using images, there are technical decisions that strongly affect the file size of the images displayed. These include:

  • Compression: Use a tool such as TinyPNG or ShortPixel to compress image files without any visible loss of quality.

  • File format: Use the most efficient file format for each image, for example WebP instead of JPEG.

  • Image size: Deliver images at the correct size instead of scaling them with CSS.

If you follow these steps, image files become much smaller. This reduces energy consumption and improves loading times, with no noticeable disadvantages for users.

2.4 Optimise fonts

There are technical ways to reduce the size of font files on websites. Try these techniques:

  • Stick to modern web font formats such as WOFF and WOFF2, which compress better than the TTF, OTF and SVG formats.

  • Subset your fonts so that they contain only the characters the website needs.

2.5 Use Accelerated Mobile Pages (AMP)

AMP is designed to make content load faster on mobile devices. It removes unnecessary code and file weight and delivers a minimalist version of the original page. In theory, AMP doesn’t help much if a website is efficient to begin with. But where a website isn’t as lean as it should be, AMP can be a useful tool: mobile users quickly get a lighter, more energy-efficient version.

Google used to favour AMP content in mobile search and mark it with a lightning bolt. Since 2021 neither applies, and fast pages are treated the same without AMP. There are downsides as well: your content may be delivered on a Google domain, and some of the things AMP takes out may be things you think are important. A page that is lean to begin with remains the better way.

2.6 Create static websites

CMS-driven websites query their database and generate pages dynamically. Put simply, the web server has to work out what information to send back every time someone loads a page, and that makes it use more energy. One remedy is server caching, but in some cases it makes sense to run a static website with no database at all.

You can do this by writing the pages as static files in HTML, CSS and JS, or by using a static site generator or a specialised static web host to convert your CMS-powered website into static files.

2.7 Use Progressive Web App technology (PWA)

Progressive web app technology lets websites use functions that are normally only found in native apps. One of the core features of a PWA is the ability to cache files on the user’s device, so that content and assets don’t have to be reloaded on repeat visits. This can greatly reduce the amount of data transferred, especially on mobile devices, where data transfer takes more energy than over a wired connection. It can also improve loading times and the user experience without any real disadvantages.

2.8 Reduce idle power consumption to zero

To make the battery last as long as possible, reduce the time spent in high-power states and let the hardware return to idle as often as possible.

For web developers, there are three states of interaction to think about:

  • When users are actively interacting with the content.

  • When the page is in the foreground but users are not interacting with it.

  • When the page is not in the foreground.

Even when users are not interacting with it, the page should use as little power as possible.

For example:

Use as few timers as possible, so that the CPU only wakes up when it needs to. Bundle timer-based tasks into a few infrequent timers. Many uncoordinated timers wake the CPU often and use more resources than a few grouped ones.

A page that keeps working in the background also responds more slowly to user interactions. Less background activity therefore improves both responsiveness and battery life.

3. Web hosting

Websites use a lot of energy in the data centre and when data travels to and from it. Choosing your web hosting carefully can therefore have a great impact on the energy efficiency and speed of your website. These are the most important points to think about.

3.1 Use server caching

For websites that use a CMS such as WordPress or Drupal, pages are generated dynamically every time someone visits. This is very inefficient, because every single page request needs server processing, which increases the web server’s energy consumption.

Caching technologies such as Varnish generate static versions of each page in advance, so the server load for most visitors drops considerably. The server uses much less energy, and pages load noticeably faster.

3.2 Select hosts with a good PUE value

Data centres are generally rated for energy efficiency with a metric called Power Usage Effectiveness (PUE). The PUE value is the total energy fed into the data centre divided by the energy used to run its computers. This shows how much energy goes to things other than computing, such as cooling.

The typical PUE for a data centre is about 1.67, which means that of every 1.67 watts flowing into the data centre, only 1 watt reaches the computing systems. Highly efficient data centres reach values as low as 1.11.

3.3 Selecting a data centre near the target groups

A large share of the energy the Internet uses goes into transmitting data through telecommunications networks. The farther information has to travel, the more energy it uses on its way. Choosing a data centre near your target audience therefore helps reduce energy consumption.

Here is an example: a US-based host may offer a cheap hosting package, but if your visitors are in the UK or Germany, energy is wasted on sending data across the Atlantic. The extra distance can also slow down page loading.

If the website sits in a data centre close to your main audience, that is good for both the user experience and the environment.

When the user base is spread all over the world, it is not so easy. Content delivery networks (CDNs) help here by delivering assets such as image files from a network of data centres around the world.

In most cases, the largest files then come from a CDN location in the users’ own region, and the data travels a shorter distance each time a page loads. This in turn improves the page’s energy efficiency and loading times.

3.4 Block bots

Blocking unnecessary bots can also reduce energy consumption. Every request from a bot costs processing power and bandwidth without anyone benefiting from it.

3.5 Use latest PHP version

Newer versions of PHP are not only faster, but also consume fewer server resources and therefore less energy.

Conclusion

The energy consumption of a website can be difficult or even impossible to measure accurately, but there is still a lot we can do to avoid waste and improve efficiency. Most of it is simple. It mainly takes attention to detail and care in every part of design, content creation, development and hosting.

The great thing is that everything we do in this direction, be it better SEO, better web performance or a better user experience, also benefits users in other ways. A more efficient website is simply a better website.

Want to apply some of this in a project?

Let us talk about your project.

Call +49 228 629 380 60 I can be reached on working days. If I cannot pick up, I will call you back. Book appointment Take a free slot in the calendar A short conversation clears up a lot.