Kruso Logo
Contact us

How to make your website sustainable

IT emits as much CO2 as the airline industry. Here you get Kruso's suggestions on how sustainability can be incorporated into your website.

Digitization makes life easier and more comfortable for all of us. It has been a mantra for many years. Therefore, User Centric Development has been in focus. But IT emits just as much CO2 as the airline industry, so we have to focus on digitization being as sustainable as possible. The good news is that it actually pays well.

Here you get Kruso's suggestions on how sustainability can be incorporated into your website.

Reduce digital resource consumption

Communicate with text Text is the easiest and therefore the cheapest way to communicate when you communicate on a website. In 1 kilobyte (kB) you can write 1000 characters. An image of 50kB is equal to a text on 20 A4 pages. If you want to communicate climate-friendly, you must therefore focus on text.

Use climate-friendly illustrations Overall, images should rarely be used if the goal is a climate-friendly website. But pictures can be made climate-friendly. By using new image formats such as webp and Avif, an image can only take up 25% of the usual jpg format. But unfortunately not all browsers "understand" the new formats, so the same image must be made available in several formats. Also consider that images with a lot of details uses more space than images with little detail. And that images with less contrast take up less space than images with high contrast. Many users do not read a web page to the bottom. Therefore, it makes good sense to only retrieve images from the server when they appear on the user's screen (lazy loading). In this way, many kB are saved. Video stands alone for over 80% of all traffic on the Internet. If you want to do something good for the climate, don't use video on your website.

Avoid Iframes and javascript There are many different services that can be inserted into a page via iframes. This can be for example videos or map views. Some iframes are very innocent and do not use many kB, but others are very heavy. Video and map views consume a lot of kB. Therefore, you have better control over how many kB the user has to transfer in order to see your website if you avoid or limit the use of iframes. Javascript makes the pages come alive in many ways. For example, it helps to open menus in a nice way, and it can retrieve content on part of the page when the user has clicked somewhere else. But many javascripts are based on frameworks that take up a lot of space. Such a framework often takes up 2MB even though the website only uses a fraction of the code that is transferred. If javascript is to be inserted on the page, it should not use large frameworks. Instead, write javascript that fits the purpose exactly. The other problem with javascripts is that they can download and send a lot of kB without the user seeing it. A small bit of javascript can use code from other websites and fetch many megabytes of traffic. An example is statistics collection from Google and event tracking via Google Tag Manager. This is where javascripts monitor the user's actions and constantly send small messages back to Google. It creates an incredible amount of traffic and draws extra resources on the user's PC/device.

Use HTML standard The next challenge is that the website must be as easy as possible for the browser to display. Resources can be saved on the individual user's PC/mobile if the website uses standard HTML and CSS. The HTML standards are continually being improved and there are today standards that solve challenges that previously required the use of javascript. Therefore, it may be a good idea to recode older websites so that they use the new HTML standards and therefore use less javascript to display the page.

Write less backend code In relation to the backend code, it is difficult to make general recommendations, since backend code can be written in many ways. Overall, it is important to make as few passes or "loops" in the code as possible. Instead of more passes in the code, it is often possible to make better extracts from the database, so that less code has to be written.

Set up caching on the pages Instead of creating the same page every time a user visits it, developers can set up caching of either the entire page or parts of the page. In this way, the server saves resources to create the page again. Caching can be set to expire after a certain time. Some pages can be cached for several weeks, while other parts of a page require caching for only a few minutes. Websites that never change can advantageously be made as static files, so that the server does not have to use a code language and database to send the website to the user.

Use DNS caching There are solutions such as Cloudflare that offer DNS caching. The first time a user queries a page's IP address, Cloudflare saves a copy of the page. The next time another user requests the same page, Cloudflare returns the page instead of sending the IP address of the page. This means that the traffic does not even reach the server, thereby saving a lot of resources on the server.

Look at server scripts Some websites have server scripts/programs that run at certain times. It can be a service that checks for dead links or sends out newsletters at certain times. That type of server scripts can use a lot of resources to control the website. Some scripts may not be important and can be stopped entirely. Other scripts can be modified so they don't run nearly as often. It is therefore important to look at these scripts to minimize resource consumption. And maybe the scripts could be changed to only activate when they are actually needed instead of running every 5 minutes. Changing a script to respond to an action instead of running every 5 minutes can save a lot of resources.

Use sustainable hosting

When you have to choose hosting for your website, it is important to choose a hosting center that runs on green electricity. And certainly not all hosting centers do. But the hosting centers that use green electricity are usually happy to talk about it. Therefore, you can often read about how far the hosting centers are in terms of sustainability on their website.

The Internet is a big spider's web, and a website's journey from the server to the user is not always the shortest path. Along the way, the website is split up into data packets, and they can follow different paths before they are reunited at the recipient. But with all the caveats, it is an advantage that the path from server to user is as short as possible. If you can choose a hosting that is close to most users, it will be a more climate-friendly solution. However, it is difficult to prove, as the shorter journey cannot be mapped.

Be sustainable as web editor

Many of the sustainability optimizations are in the code, and it is difficult for the editor to make any difference here. But there are several sustainable decisions that the web organization can make:

  • Is the website necessary?

  • Is this page necessary?

  • When can I delete the page?

  • Can I communicate via more sustainable formats?

  • How much statistics do I need? Do I use the statistics?

  • Do we need to support old browsers?

  • Can I change a website to be static files instead of being based on a CMS that uses database and more server power

Great advantages of thinking about sustainable web

It is not uncomplicated to think sustainability into a website, and in some cases it places limitations on communication, but there are also clear advantages. When your website uses fewer resources, it is displayed faster to the user, and the improved speed means that the website's search engine optimization is improved. When the website simultaneously sends fewer kilobytes, the resource consumption will be further reduced. The lower resource consumption on the server can perhaps reduce your costs for hosting, as many cloud services are settled on consumption. Websites using standard HTML have better web accessibility. And websites that are web accessible make it easier for search engines to read them. Last but not least, the signal value of a sustainable website can in itself be a gain for your company or organisation.