Web Development

How to Improve Website Loading Speed

Rejaul Karim8 min read

Speed is not a luxury feature. Visitors judge a website within seconds, and a slow page costs you readers, sales and search visibility. Google's own research from the mid-2010s found that the chance of a mobile visitor leaving rises sharply as load time grows from one second to three seconds, and that more than half of mobile visits are abandoned when a page takes longer than three seconds to load. Browsers and networks have improved since then, but people's patience has not. This guide explains how to measure your site's speed correctly and the practical changes that improve it the most.

Step 1: Measure first, using the right metrics

Do not guess what is slow. Run your key pages through PageSpeed Insights, which combines two kinds of data: field data from real Chrome users over the previous 28 days (when your site has enough traffic) and lab data from a simulated test using Lighthouse. Other useful tools include Lighthouse in Chrome DevTools, WebPageTest for detailed waterfall charts and the Core Web Vitals report in Google Search Console, which groups your pages by status.

The three Core Web Vitals

Google's Core Web Vitals measure real user experience, and they are part of the page experience signals it considers. Each has a threshold for a "good" score, assessed at the 75th percentile of visits:

  • Largest Contentful Paint (LCP): how quickly the main content appears. Good is 2.5 seconds or less; poor is over 4 seconds.

  • Interaction to Next Paint (INP): how quickly the page responds when users click, tap or type. Good is 200 milliseconds or less; poor is over 500 milliseconds. INP replaced First Input Delay as a Core Web Vital in March 2024.

  • Cumulative Layout Shift (CLS): how much the layout jumps around while loading. Good is 0.1 or less; poor is over 0.25.

Also watch Time to First Byte (TTFB), the time before the server starts sending data. It is not a Core Web Vital, but a slow TTFB delays everything else, and a value under roughly 800 milliseconds is generally considered good.

Step 2: Optimise your images

Images are usually the largest part of a page, so this is where most sites gain the most.

  • Use modern formats. WebP and AVIF produce much smaller files than JPEG or PNG at similar quality. Most current browsers support both.

  • Resize before uploading. Do not upload a 4000-pixel photo to display it at 800 pixels. Use the srcset and sizes attributes so the browser picks an appropriate size for each device.

  • Compress. Tools such as Squoosh, ImageOptim or a build step can cut file size dramatically without visible loss.

  • Lazy-load below-the-fold images with the loading="lazy" attribute. Do not lazy-load the main image at the top of the page, since it is usually your LCP element. For that image, consider fetchpriority="high".

  • Always set width and height (or an aspect ratio) so the browser reserves space and avoids layout shifts.

  • Use SVG for logos and icons, and avoid animated GIFs, as short MP4 or WebM videos are far lighter.

Step 3: Choose better hosting and use a CDN

Even a perfect site is slow on a congested server. If your TTFB is poor, look at the hosting first. Shared hosting on a crowded server can be sluggish, while managed hosting, a VPS or a platform with built-in edge delivery is often much faster. A content delivery network (CDN) stores copies of your files on servers around the world and serves visitors from the closest one, which reduces latency. Cloudflare, Fastly, Bunny and others offer CDN services, and several have free tiers. Make sure your host supports the current protocols, HTTP/2 and ideally HTTP/3, and a recent PHP version if you use WordPress.

Step 4: Turn on caching

  • Browser caching: set long cache lifetimes (via the Cache-Control header) for static files such as images, fonts, CSS and JavaScript, with versioned file names so updates still reach users.

  • Page caching: store the finished HTML of pages so that the server does not rebuild them on every visit. This matters most for WordPress and other database-driven sites.

  • Object and database caching: tools such as Redis or Memcached reduce repeated database work on busy sites.

Step 5: Compress and minify code

Enable Brotli (or at least gzip) compression on your server, which commonly shrinks text files by well over half. Minify CSS, JavaScript and HTML by removing whitespace and comments. Most build tools and caching plugins do this automatically.

Step 6: Reduce and defer JavaScript

JavaScript is expensive: the browser must download, parse and run it, and heavy scripts are the leading cause of poor INP.

  • Remove libraries and plugins you no longer use. Audit with Chrome DevTools' Coverage tab to see how much code is never run.

  • Load non-critical scripts with the defer or async attribute so they do not block rendering.

  • Split large bundles so each page loads only the code it needs.

  • Be ruthless with third-party scripts such as chat widgets, ad networks, tracking pixels and social embeds. Each one can add many requests and delay interaction. Load them late, or remove those that do not earn their cost.

Step 7: Streamline CSS and fonts

  • Inline the critical CSS needed for the top of the page and load the rest asynchronously, so the browser can paint sooner.

  • Limit font files. Use two families at most, with only the weights you need. Prefer modern WOFF2 files, serve them from your own domain, and use font-display: swap so text shows immediately.

  • Preload the one or two fonts used above the fold.

  • Consider system fonts for body text, which load instantly.

Step 8: Prevent layout shifts

Pages that jump around are annoying and hurt CLS. The usual culprits are images and videos without dimensions, ads and embeds that load late and push content down, and web fonts that swap in with different sizes. Reserve space for every element that loads asynchronously, give ad slots a minimum height and avoid inserting new content above existing content.

Step 9: Reduce requests and redirects

Each request adds overhead. Combine small icons into one SVG sprite, remove unused plugins and avoid chains of redirects, such as one from http to https to www. Use preconnect hints for essential third-party origins so the connection starts early.

WordPress-specific tips

  • Use a lightweight, well-coded theme, and avoid page builders that add heavy markup where possible.

  • Deactivate and delete plugins you do not need, and test the speed impact of each new one.

  • Install one reputable caching plugin, plus an image optimisation tool that converts to WebP.

  • Keep WordPress, themes and plugins updated and use a current PHP version.

  • Clean the database of old post revisions and spam, and limit how many posts load on archive pages.

Step 10: Monitor continuously

Speed degrades silently as you add features, plugins and content. Re-test key pages after every significant change, keep an eye on the Core Web Vitals report in Search Console and consider a performance budget, a limit on page weight or script size that your team agrees not to exceed. Test on a mid-range Android phone with a throttled connection, not just on your fast laptop, because that is closer to what many visitors experience.

A prioritised checklist

  1. Run PageSpeed Insights and note your LCP, INP, CLS and TTFB.

  2. Compress and resize images, convert to WebP, and set dimensions.

  3. Enable caching and Brotli or gzip compression.

  4. Put your site behind a CDN.

  5. Defer or remove unneeded JavaScript and third-party scripts.

  6. Optimise fonts and critical CSS.

  7. Fix layout shifts.

  8. Upgrade hosting if TTFB remains high.

  9. Re-test and monitor monthly.

Final thoughts

Website speed is rarely fixed by a single trick. It improves through a series of sensible decisions: lighter images, less JavaScript, smarter caching and decent hosting. Start with measurement, tackle the biggest problem first, and verify each change. A faster site keeps visitors, helps your search rankings and makes everything you do online work better.

  • core web vitals
  • page speed
  • performance
  • seo

Comments

Leave a comment

← All posts