Fixed-price website design from £2,400View Prices

Website Speed Optimisation: How to Make a Website Load Faster

Where the time goes when a page loads, and the fixes that make the biggest difference, in the order worth doing them.

Performance and Accessibility guide. 6 minute read. Updated .

In short

  • Most slow websites are slow for the same few reasons: oversized images, too much JavaScript, third-party scripts and slow hosting.
  • Measure before changing anything, on a phone connection, and fix the biggest problem first.
  • Images are usually the largest part of a page, and the easiest to shrink.
  • Every script a page loads has to be downloaded and run. Removing one is better than optimising it.
  • Speed is not a one-off project. Sites slow down as things are added, so check regularly.

A slow website loses people. They tap a link, watch a blank screen and go back to the search results before your page has had a chance to say anything. The frustrating part is that most slow sites are slow for ordinary, fixable reasons, and the fixes are well known.

This guide goes through them in rough order of impact. It is written for business owners as much as developers: you may not make the changes yourself, but knowing where the time goes lets you ask the right questions.

Measure First

Speed work without measurement is guesswork. Start by finding out how the site performs for a real visitor on a phone, which is the hardest case and often the most common one.

  • Run key pages through PageSpeed Insights and read the mobile results.
  • Check the Core Web Vitals report in Search Console for the site as a whole.
  • Open the Network panel in your browser's developer tools to see every file a page loads, how large each is and how long it takes.
  • Test more than the home page. Product pages, articles and anything with a gallery are often heavier.

Our guide to Core Web Vitals explains the three measurements these tools report. Use them to decide what to fix, and test again after each change so that you know what worked.

Where the Time Goes

StageWhat happensWhat slows it
ConnectingThe browser finds the server and opens a secure connectionDistance to the server, and extra connections to other domains
Server responseThe server builds and sends the pageSlow hosting, uncached pages and heavy database work
DownloadingStylesheets, scripts, fonts and images arriveLarge files, too many of them and no compression
RenderingThe browser lays out and paints the pageStylesheets and scripts that block the first paint
Becoming usableScripts run and the page responds to inputToo much JavaScript, especially from third parties

Optimise the Images

On most pages, images account for more of the download than everything else put together. They are also the easiest thing to fix.

  • Resize each image to the dimensions it is actually shown at. A photograph 4,000 pixels wide in a box 400 pixels wide is nearly all waste.
  • Use a modern format, AVIF or WebP, which are far smaller than JPEG or PNG at the same quality.
  • Compress sensibly. Most photographs can lose a great deal of data before anyone notices.
  • Serve different sizes to different screens with srcset.
  • Lazy load images below the first screen, and never the one at the top.

Our guide to image optimisation covers each of these in detail.

Cut the JavaScript

JavaScript is the most expensive kind of file a page can load. It has to be downloaded, parsed and executed, and while it runs the page cannot respond to the visitor. The best optimisation is not to send it.

  • Remove libraries and plug-ins that are no longer used. Old sites accumulate them.
  • Replace script-driven effects with CSS where possible. Menus, accordions and animations often need no script at all.
  • Load scripts with defer, so that they do not hold up the first paint.
  • Split large bundles so that each page loads only what it needs.
  • Be honest about heavy features. A slider or an animation library used on one page should not be loaded on all of them.
<script src="/js/site.js" defer></script>

<script type="module">
  const button = document.querySelector("#open-map");

  button.addEventListener("click", async () => {
    const { showMap } = await import("/js/map.js");
    showMap();
  });
</script>
A deferred script that does not block rendering, and a heavy feature that is loaded only when the visitor asks for it.

Tame Third-Party Scripts

Code from other companies is often the largest and least controlled part of a page: analytics, advertising tags, chat widgets, social media embeds, review badges, heat maps and video players. Each one was added for a reason, and together they can outweigh the rest of the site.

  • List every third-party script on the site and who asked for it. Remove any that nobody uses.
  • Load the rest after the page is usable, not before.
  • Replace embeds with a simple image and link that load the real thing on a click. An embedded video player can be heavier than the whole page around it.
  • Review tag managers regularly. They make scripts easy to add and easy to forget.
  • Prefer one analytics tool to three.

Caching, Compression and Delivery

  • Compression. Text files such as HTML, CSS and JavaScript should be compressed with Brotli or gzip. It is a server setting, and it reduces their size dramatically.
  • Browser caching. Files that rarely change, such as fonts, images and scripts, should be stored by the browser so that a second visit loads almost instantly.
  • A content delivery network. A CDN keeps copies of your files on servers around the world, so that each visitor is served from one nearby.
  • Modern protocols. HTTP/2 and HTTP/3 load many files efficiently over one connection. Most good hosts support them.
  • Static or cached pages. A page built once and served as a file is far quicker than one assembled from a database on every visit.

Hosting and Server Response

Everything else waits for the server's first response. Cheap shared hosting, where hundreds of sites compete for the same machine, can add a long delay before a single byte arrives, and no amount of image optimisation recovers it.

Signs of a hosting problem are a slow first response even for a simple page, speed that varies with the time of day and timeouts under modest traffic. The remedies are better hosting, caching and a CDN in front of the site. Our guide to website hosting for startups explains the options, and the sites we build can run on our own managed cloud hosting from £20 a month.

Fonts and Stylesheets

  • Use WOFF2 fonts, limit the number of weights and set font-display: swap.
  • Preload the font used in the main heading.
  • Remove unused CSS. Frameworks and themes often ship far more than a site uses.
  • Keep the stylesheet needed for the first screen small, so that the page can be painted quickly.
  • Avoid @import in stylesheets, which loads files one after another instead of together.

Our guide to web typography covers font loading in more detail.

Keeping a Website Fast

Websites rarely become slow in one step. They slow down gradually, as a tracking script is added here, an uncompressed photograph there and a new plug-in for a campaign that ended months ago. Staying fast is a matter of habit.

  • Set a budget: a maximum page weight and a target for each Core Web Vital.
  • Check the speed whenever something significant is added.
  • Compress every image before it is uploaded, or have the site do it automatically.
  • Review third-party scripts twice a year.
  • Look at the Search Console report every month.

Putting It Into Practice

Reading about a technique is the easy part. Applying it to a real business, with real content and a launch date, takes judgement about what to use and what to leave out. DigitalPod is a UK-based design and web development studio that designs every site from a blank page and builds it by hand, so a technique is used because it helps the business and not because a template came with it. If you would like a website designer to handle it for you, startup website design is what we specialise in, websites start from £2,400 and our website redesign service brings an older site up to date.

Frequently Asked Questions

Why is my website slow?

The usual causes are images that are far larger than they need to be, too much JavaScript, scripts from third parties such as chat widgets and advertising tags, and slow hosting. A test with PageSpeed Insights will show which of these applies to your site.

How fast should a website load?

A sound target is the one Google uses: the main content of the page should appear within 2.5 seconds on a typical phone connection, and the page should respond to taps within 200 milliseconds. Faster is better, but meeting those thresholds puts a site in good shape.

Does website speed affect SEO?

Yes, modestly. Speed is measured through the Core Web Vitals, which are one of many ranking signals. Relevance matters far more, but speed can separate similar pages, and a slow site loses visitors whatever its position.

What is the quickest way to speed up a website?

Optimise the images. Resizing them to the dimensions they are displayed at, converting them to a modern format and compressing them usually removes more weight than any other single change. Removing unused scripts comes second.

Will better hosting make my website faster?

It will if the server is the bottleneck, which shows as a slow first response even on simple pages. Better hosting, caching and a content delivery network shorten that wait. If the delay comes from large images or heavy scripts, hosting alone will not fix it.

Want a Website Built This Way?

DigitalPod designs and builds websites for startups and growing UK businesses, with everything handled in-house from the first sketch to launch. Startup website design starts from £2,400, or you can read what clients say in our Trustpilot reviews.

Get a quote

Related Web Design Techniques

More from our web design techniques guides. For costs, briefs and choosing a designer, see the startup blog.