Ten steps to greening your website

As we re-evaluate our lifestyles in the face of global climate change, it's not just how we heat our homes, how we travel, work, rest, play and consume that needs a major re-think. Our websites also consume carbon, and we need to deal with this. As Tom Greenwood (see below) says, "If the internet were a country, it would be the sixth most polluting country in the world, with annual emissions similar to those of Germany".

Fortunately, doing something about this is relatively easy, but only if we all play our part. Just as charity begins at home, so does the walk that we can talk about. This post therefore aims to step through the issues that matter and show you what you can do with your website. It uses this Backdrop CMS website as the example, but much of these details will be transferable to your website's platform, be it WordPress, Drupal or whatever.

A website's carbon consumption has a surprisingly long life-span. Our computers are busy as we push pixels at the design stage and wrangle code at the development stage. As the process moves from development to staging to launch, the hosting company itself becomes part of the audit. Then there is the longer-term energy use involved in serving page after page to the site's visitors. At each of these steps there are decisions we can take that can reduce the energy consumed. The good news about this is that by auditing these issues, you will be able to adopt leaner habits with longer-term energy savings. These will then be repeatable for each project, and you'll want to refine the details as you go.

Measuring your progress: the tools to use

As you work through some of these steps, objective measurement will be your guide so that you can judge progress. I suggest that you use Web Page Test, which has been around for years (and has recently undergone a makeover), and Website Carbon Calculator, which is a newcomer that will forever change the way you think about web design. Before going any further, test your own website using these online tools, note the results, saving screenshots of the details where appropriate. These will be your benchmarks as you iteratively work through each of the ten steps that follow. You will need to look for specific details, as follows:

A. Web Page Test details to note

You will be interested in many of the results spat out by WPT but for the purposes of carbon consumption you should note the "Fully Loaded / Bytes in" measure. This is the weight of the page being tested as measured in kilobytes. It is what the server's processing spits out. It is what your website's visitors' machines and browsers need to process. The smaller, the better.

Web Page Test results Fully Loaded - Bytes in screenshot

To put this kilobytes number in perspective, HTTP Archive attests to the fact that median desktop page weights in November 2010 were 473 kilobytes, and that this increased to 2,000 kilobytes in January 2021. A breakdown of these numbers is revealing:

Page weight trends, desktop, whole numbers - by resource (from HTTP Archive)
Resource November 2010 January 2021
Total kilobytes 473 2,000
Total requests 58 70
CSS kilobytes 16 70
CSS requests 3 7
Font kilobytes 59 100
Font requests 1 4
HTML kilobytes 19 20
HTML requests 3 3
Image kilobytes 229 900
Image requests 37 26
JavaScript kilobytes 88 430
JavaScript requests 9 21
Other kilobytes 4 .9
Other requests 0 3
Video kilobytes 0 1,678
Video requests 0 3

Carbon guzzling culprits are clearly images and JavaScript, with fonts coming a close third. Also note that the quantity of HTML - predominantly the text that visitors read - has barely changed over time. Our websites are clearly doing more now than simply serving up information. You can get a breakdown of numbers like these for your own website by clicking the Content tab:

Web Page Test results Content tab screenshot

One of the excellent features of the free Web Page Test service is that it keeps your test results for up to a year. Once you are viewing test results, just access them using the Test History tab on their main menu:

Web Page Test results Content tab screenshot

B. Website Carbon Calculator details to note

Over on the Website Carbon Calculator website, the percentage measure is what you should note. It will be either "cleaner than x% of web pages tested" or "dirtier than x% of web pages tested". (The cleaner measure will display if the percentage score is 50% or above; the dirtier measure will display if the percentage score is below 49%.) The cleaner, the better. Just note that each page result is cached on their website for that day. If you've made a change to a page (making it 'cleaner', presumably), then don't re-test by hitting F5. Just be patient and wait until the next day.

Using these two metrics of a page's weight and the energy consumption required to display it results in a convergence that won't be lost on you. Greener pages - if we can call them that - will mean faster pages, although the reverse is not automatically true. (You may, for example, have a super-fast page served by a hosting company that doesn't use sustainable energy.) Faster pages will also result in a more satisfying experience for your users. The takeaway is that by aiming to make your website more sustainable, all other things being equal, you will also be providing a better user experience.

Let's get started . . .

Step 1.Renewable energy for hosting - and for development

The Website Carbon Calculator makes a fairly good stab at assessing whether your website hosting is run on sustainable energy. If in doubt, you can check with your hosting company. These days, hosting companies that use 'sustainable energy' will usually proclaim it proudly. If they say that it's run on 100% renewable electricity from sources like sun, wind and sea, then that's better than vague carbon offsets or tree planting on its own. If the electricity running your computer under your desk is supplied the same way, then you will be doing something right. You might also question where your hosting company's servers are geolocated. The closer they are to your intended audience, the better.

This might raise the issue of whether you have opted for a content-delivery network (CDN), which might generally be a good thing in terms of sustainability as it will reduce the megabyte miles that your larger files have to travel. But the energy saving in using a CDN may be offset if the CDN provider doesn't use sustainable energy. Check first.

STEP SUMMARY: Sustainable energy as you work and when your website is served to your users.

Step 2.Image compression

We can see from the above table that images are the greatest source of weight. They will make the single greatest demand on the energy resources used to build a site, to host it, and to serve it to users. As Henri Helvetica says over at the HTTP Archive's Web Almanac, images "will also be our greatest source of savings". There are plenty of ways of dealing with this.

I've written before (different post, this site) about one option for maximum compression of JPEG images using JPEGMini Pro. This is either a stand-alone app or a Photoshop/Lightroom plug-in that squeezes another 30% or so of file size out of JPEGs over and above what you can already accomplish with Photoshop, all with no discernible difference to the human eye There are alternatives.

STEP SUMMARY: You may be able to shrink all your JPEG image files by as much as 30%.

Using WebP images instead of JPEGs could shave yet another 30% off any images you use. The best, free batch converter for Windows that I know of is XnSoft's XnConvert. By using an 80% quality setting with compression method 4 and filter strength 60, I've reduced 42 extra-large JPEGs weighing a total 29Mb to a total WebP image format weight of 15Mb. Comparable savings are possible with the smaller files that your site will typically be serving.

I remain mildly nervous that WebP doesn't enjoy total support, although CanIUse reports that only IE 11 doesn't support the WebP image format, which wouldn't normally bother me if it weren't for the fact that most users of IE 11 do so because their accessibility software requires it. Whilst we can celebrate that Microsoft 365 apps dropped support for IE 11 in November 2021, it remains the case that there is a stubborn hold-out of IE 11 users worldwide, estimated at between 1.4% and 2.5% of site visits. (See an excellent article about this by Graham Armfield of Hassell Inclusion.) If I could be sure that this rump of users - often in public libraries where funds are extraordinarily tight - had largely vanished, I'd swap out all the JPEGs I use and replace them with WebP equivalents. The reduction in megabyte miles would be very substantial. Until then, maximum compression of JPEG will have to suffice.

STEP SUMMARY: You may be able to reduce total image payload by another 30% by choosing WebP over highly-compressed JPEG files.

There are three other steps that you could take to reduce the size of the images that your website serves. The first two can be used in conjunction with JPEG 'super-compression' or using WebP image formats:

  • You could try using monochrome images instead of 24-bit colour JPEG images. In some situations, this is not just adequate but even visually desirable, creating an atmospheric image that these days can stand out from the crown of over-pumped HDR colour images.
  • You could try blurring the parts of an image that aren't key to appreciating the image's main subject. Photoshop filters do this nicely. By reducing detail in this way you also reduce file size.
  • Stop serving images altogether - or at least stop serving them gratuitously. I'm not prepared to do this just yet, but I can imagine taking such a step at some point.
STEP SUMMARY: You may be able to shave even more off the weight of your image files if you blurred peripheral areas of larger images or used monochrome formats instead of colour formats or - radically - stopped using them altogether.

Step 3.Audit your JavaScript

JavaScript is the second bulkiest resource our websites serve. On this site, of the 116kb of JavaScript being served (after compression), a whopping 90 or so kilobytes were being used by the beautiful image lightbox/gallery MagicZoom library (separate post, this site). You will use your own lightbox/gallery library to serve your larger (but well-compressed?) images - but check for code bloat.

I have been able to replace that with the ultra light-weight lightbox/gallery Featherlight.js. There's a Featherlight module for Backdrop which provides a field formatter and the ability to load the library manually. The library consists of a mere 400 lines of JavaScript, 100 of CSS and it weighs in at a miniscule 6 kilobytes combined. What one ditches in beauty one gains in fleetness of foot. It also works on everything all the way back to IE 8, including mobiles.

STEP SUMMARY: You may be able to reduce the weight of your website by even 100kb by choosing a more fleet-of-foot image gallery/lightbox system.

Step 4.Font choice, location and weight

I have used Adobe Typekit and Google Fonts to serve fonts. The payload they add to a site is not inconsiderable. By keeping to two font files, one for display headings and one for body text, the added weight is around 57kb. Your font payload will vary. However, there are two ways of lightening this load. The first of these could be to host your own fonts which would have the benefit of not needing to ask for them to be delivered by a separate server. You would need to make use of the @font-face rule at the start of your CSS along these lines, after which you would refer to the font by the font-family alias that you have given it.

@font-face {
	font-family: 'xyz serif alias';
	font-style: normal;
	font-weight: 400;
	src: local(''),
		 url('fonts/xyz-serif.woff') format('woff'),
		 url('fonts/xyz-serif.ttf') format('truetype');
	font-display: swap;

The ttf font will be served to Safari and Android browsers, while the woff font will be served to most other ('modern') browsers. As usual, provide a fall-back, generic font-family further down in your CSS, as this will cater for situations, such as Opera Mini, that can't handle the @font-face rule.

h1, h2, h3 {
	font-family: 'xyz serif alias', 'Times New Roman', Times, serif;
STEP SUMMARY: You may be able to reduce megabyte miles by hosting your own fonts.

The second way to slim down the weight of your site's typographic requirements would work if you went with the self-hosting option described above, but this will depend upon your requirements in terms of languages, accented letters and glyphs (such as currency symbols and curly quotes). If you need little of these and can serve your text with a minimal set of font glyphs, then you could derive subsets of the font files you use - on the further condition that the licensing terms of the fonts in question permitted that. If you're interested, Everything Fonts have font subsetter utility which will take your original font file and allow you to select only those glyphs you require before generating a slimmer subset font file which you can plug in instead. You may shave a further 25% - 50% off these file sizes. Work out what that means by subtracting the subset file sizes from the original file sizes and then multiplying the difference by the numbers of user's first visits to your site. You'll be dealing with approximations, but there will be an energy saving.

STEP SUMMARY: You may be able to reduce your custom font file sizes by 25% - 50% if you subset them by removing unused glyphs.

If you really wish to put a green hair shirt on your website, ditch all custom fonts and specify system fonts only. There is a roll call of venerable fonts installed on machines out there, so one could do worse by not having the likes of Arial, Verdana, Helvetica, Tahoma, Trebuchet MS, Times New Roman, Georgia and Garamond fonts. I'm not brave enough for this - yet.

STEP SUMMARY: You may be able to ditch all custom font files by using system fonts already installed on your users devices. On this website this would save 57kb being imposed on my visitors.

Step 5.Cache, aggregate, compress and minify

Your CMS will offer you the ability to configure your website to aggregate and compress CSS files, and to aggregate JavaScript files. You may also be able to 'minify' your HTML, CSS and JavaScript, that's to say to strip out the white spaces, line breaks and comments, and thus shave off a bit more size from the files that our served.

You should also ensure that you have your site configured to utilise server-side GZIP compression for CSS, JS and HTML resources. The Web Page Test resource mentioned above will guide you on accomplishing this. It's well-worth doing and will enable you to secure its coveted A grade, as in the fourth icon from the left shown here, confirming that you will have reduced the total weight of resources that a page request serves.

Web Page Test six grade A icons
STEP SUMMARY: All these techniques will shave kilobytes off the files that your website serves, as well as speeding up the transfer of many of your site's resources.

Step 6.Help users avoid Yoyo navigation

One feature of good website design is to provide navigational aids on as many pages as possible. By providing users the ability to navigate horizontally as well as only vertically, you can help speed them to their destination and reduce unnecessary visits back up to a parent or home page before they nip back down again to a different page. Tom Greenwood calls this latter behaviour 'Yoyo user journeys', wasteful of user time, server processing and bandwidth.

One obvious way of avoiding this is to provide a menu of blog post titles alongside the blog post that the user is currently reading. They can then use these links to move horizontally. It's surprising how many site designers even today don't rate this simple affordance. If it's good for users, it's probably also good for the planet. Provide menus wherever possible.

STEP SUMMARY: Although browsers cache pages that have been visited, providing sufficient navigation to reduce multiple visits to the same page will reduce some of the carbon expenditure that poor design imposes on users.

Step 7.Generating less markup (Backdrop and Drupal examples given)

Both Drupal and Backdrop can be configured to generate less markup, particulars through the Views database reporting engine. (Your CMS is likely to have similar options.) The format settings for all views offer the ability to add views row classes and/or add striping (odd/even), first/last row classes. Not selecting these will not generate that additional markup:

Choosing not to add views row classes and/or add striping (odd/even), first/last row classes
Leave unchecked the option to add views row classes and/or add striping (odd/even), first/last row classes.

A similar option exists at the row style level where you can disable the addition of default field wrappers to the markup:

Leave unchecked the option to add default field wrappers
Leave unchecked the option to add default field wrappers

Making these choices will get you from this:

<div class="views-row views-row-8 even">
	<div class="views-field views-field-title">
		<div class="field-content">
			<a href="https://www.rob-tomlinson.com/blog/bbc-sounds-app-and-ontabletfling-event">The BBC Sounds app and the onTabletFling() event</a>
	<div class="views-field views-field-created">        
		<span class="field-content">November 24, 2019</span>  
With no code-stripping. The page's HTML weighs 268kb uncompressed.

to this:

<div class="views-field views-field-title">
    <div class="field-content">
        <a href="https://www.rob-tomlinson.com/blog/bbc-sounds-app-and-ontabletfling-event">The BBC Sounds app and the onTabletFling() event</a>
<div class="views-field views-field-created">        
    <span class="field-content">November 24, 2019</span>  
With Views classes and row striping stripped out. The page's HTML weighs 267kb uncompressed.

and eventually to this:

    <div class="field-content">
        <a href="https://www.rob-tomlinson.com/blog/bbc-sounds-app-and-ontabletfling-event">The BBC Sounds app and the onTabletFling() event</a>
    November 24, 2019
With Views classes and row striping stripped out - and without default field wrappers. The page's HTML weighs 261kb uncompressed.

These reductions in page weight are minimal, and the whole exercise smacks of extreme nerdery, but the reduction in megabyte miles over the life of these pages will contribute to a smaller carbon footprint. Even greater savings will be made if these steps are taken with more complex menu system such as site maps. (It's not unheard of to make 20kb of savings on some pages with these choices.) Your CMS is likely to have similar options.

Targeting markup in your CSS when these additional field wrappers aren't there is a little more demanding, but all of that is eminently do-able, as all content has context which CSS styles can latch onto.

STEP SUMMARY: You may be able to shave small amounts of HTML from your pages by stripping out the tendency of your CMS to wrap everything in divs.

Step 8.Stop uploading video files

Agree never to upload video files ever again! They weigh too much and will, according to Cisco, take up 82% of all consumer traffic by 2022. (That way you'd also be better placed to join the fight against the tide of 'deep fakes' that is about to break upon us.) Besides, even one video file on your website will undo most of the good work you might have accomplished with any of the steps mentioned here.

STEP SUMMARY: The chances are that if you're really keen on having video on your website, you won't have been interesting in reading this post anyway. Hmmm.

Step 9.Standards compliance

As a long-time advocate of building websites with as 'valid as possible' code, I'm making a case that valid code uses less processor cycles and thus less carbon in a page's lifetime.

There are times when it's not possible to output the desired 100% valid code as judged by the World Wide Web Consortium's Nu Html Checker. Your CMS or several of the modules or plug-ins you've chosen to use with it may be errant in this regard. I'm tempted to say that your choice could have been better, but I'll cut you a little slack on the matter - if only because I too find it an uphill struggle to always output clean code. But you did try, didn't you?

Brazen disregard for web standards has always struck me as unprofessional. It now strikes me as been unsustainable too. After all, if your users' browsers are perpetually occupied error-handling code that you didn't take the trouble to check out and clean up, then you've created something less sustainable than would otherwise be the case. (Watch this space for more detail on this shortly.)

If you object to this point of view, the chances are that you are pushing back against making your own website generate valid code - rather than pushing back against the broader argument in favour of making your website greener. Let me know if you think I'm wrong about this.

STEP SUMMARY: Valid code means less processor cycles means less carbon.

Step 10.The Website Carbon badge

Read about the Website Carbon Badge and then install it with pride on your own website. Once you have your site's structure nicely toned, the badge will be a reminder to you that the weight of your content will vary from page to page. The presence of the badge will also attract curiosity and the word will spread!

STEP SUMMARY: Having the Website Carbon Badge on your website will show that you care about your website's carbon emissions. It will also help spread the word.


If you've worked through the above steps, the chances are that the total bytes loaded by a page on your website will have been substantially reduced. As measured by Web Page Test, you will be able to compare where you are now with where you were with the page that you tested when you started this process. Is it any greener, and is the whole of your website greener as well?

Web Page Test results Fully Loaded - Bytes in screenshot 2

Tom Greenwood's inspiring book, Sustainable Web Design

Tom Greenwood's Sustainable Web Design

Finally, for your step 11, read Tom Greenwood's inspiring book Sustainable Web Design on this subject.

This small book could be the catalyst to transforming how website builders think about the work they do. But fear not: Sustainable Web Design is jam-packed with advice on how to make a website consume less energy. Hardly any aspect of the work that web designers and coders do is neglected.

What also jumps off these pages is that making a site sustainable also makes it faster; what makes a site use less energy also makes it a better experience for the user. This set of inter-connected relationships is made compellingly attractive, if not irresistible, by the author. So do the planet a favour and grab yourself a copy of this book (even in eBook format) and join the movement.