A fast website feels trustworthy, ranks better and converts more visitors. A slow one loses people before they see what you offer, especially on mid-range phones and mobile data, which is how a large share of visitors browse. This guide focuses on the techniques that make the biggest real-world difference.

Measure before you optimise

Start with data, not guesses.

  • Field data shows what real visitors experience. Check the Core Web Vitals report in Google Search Console, PageSpeed Insights' real-user section, or a monitoring tool such as Vercel Speed Insights.
  • Lab data from Lighthouse or Chrome DevTools helps you find and debug the causes.

The three Core Web Vitals:

  • Largest Contentful Paint (LCP): when the main content appears. Good is 2.5 seconds or less.
  • Interaction to Next Paint (INP): how quickly the page responds to taps and clicks. Good is 200 milliseconds or less.
  • Cumulative Layout Shift (CLS): how much the layout jumps. Good is 0.1 or less.

Test on a mid-range Android phone or with CPU and network throttling. A page that is fast on a developer's laptop can be slow for your customers.

Images: usually the biggest win

  • Use modern formats. WebP and AVIF are typically much smaller than JPEG or PNG at similar quality.
  • Serve the right size. Use responsive images with srcset and sizes so phones download phone-sized files.
  • Lazy-load below the fold. Add loading="lazy" to images further down the page, but never to the main hero image.
  • Prioritise the LCP image. Give it fetchpriority="high", or preload it, so the browser fetches it first.
  • Set width and height so the browser reserves space and the layout does not shift.
  • Compress with tools such as Squoosh or an image CDN.

JavaScript: ship less, run less

JavaScript is the most expensive resource per kilobyte because it must be downloaded, parsed and executed.

  • Split code by route so each page loads only what it needs.
  • Load heavy components on demand, such as charts, maps, editors and video players.
  • Remove unused dependencies and check bundle size with an analyser.
  • Prefer server-rendered or static HTML for content, so the page appears before JavaScript finishes.
  • Defer non-critical work until after the page is interactive or the browser is idle.

Third-party scripts

Chat widgets, analytics, tag managers, social embeds and ad scripts often cost more than your own code.

  • Audit them regularly and remove what you do not use.
  • Load them after the page is interactive or on user interaction, for example loading a chat widget only when its button is clicked.
  • Replace heavy embeds with lightweight placeholders that load the real thing on click.

CSS

  • Keep CSS small and remove unused styles; utility-first frameworks such as Tailwind generate only the classes you use.
  • Inline the critical CSS needed for the first screen when it helps.
  • Avoid large CSS frameworks if you only use a fraction of them.

Fonts

  • Self-host fonts instead of loading them from a third-party server, which removes an extra connection.
  • Use few weights and styles, or a single variable font.
  • Subset fonts to the characters you need.
  • Preload the main font file and use font-display: swap so text is visible immediately.
  • Consider system fonts, which load instantly and look native on each platform.

Caching and delivery

  • Serve assets from a CDN close to visitors.
  • Give fingerprinted assets (files with a hash in the name) a long cache lifetime and mark them immutable.
  • Enable Brotli or gzip compression.
  • Use HTTP/2 or HTTP/3, which most modern hosts provide by default.

Rendering strategy

  • Static generation for pages that change rarely: the fastest option.
  • Server rendering for dynamic pages that must be indexed or personalised.
  • A static shell for client-rendered apps: send meaningful HTML for the first screen so visitors see content before JavaScript loads.
  • Streaming to send the top of the page while slower parts are still loading.

Improving responsiveness (INP)

  • Break up long tasks. Any JavaScript task over 50 milliseconds can delay a response; split large work into smaller chunks and yield to the browser.
  • Keep event handlers light. Update the screen first, then do the heavy work.
  • Avoid expensive visual effects over moving content, such as large blur filters, which make the next frame slow to paint on phones.
  • Avoid unnecessary re-renders in frameworks like React with memoisation and well-placed state.
  • Use transitions for non-urgent updates, such as filtering a long list, so typing stays smooth.

Preventing layout shift (CLS)

  • Reserve space for images, videos, ads and embeds.
  • Do not insert banners above existing content after load.
  • Match fallback font metrics to the web font.
  • Animate with transform and opacity, not with properties that change layout.

Set a performance budget

Agree limits, such as total JavaScript per page, image weight and an LCP target, and check them in your build pipeline. Budgets stop performance from slowly degrading as features are added.

Checklist

  • Real-user Core Web Vitals are measured per page.
  • The LCP image is prioritised and correctly sized.
  • Images below the fold are lazy-loaded and in modern formats.
  • JavaScript is split by route, and heavy components load on demand.
  • Third-party scripts are audited and deferred.
  • Fonts are self-hosted, subset and preloaded.
  • Assets are cached on a CDN with compression.
  • No long tasks block taps on a mid-range phone.
  • Images, embeds and banners have reserved space.
  • A performance budget is checked on every release.

Conclusion

Most of the speed comes from a few habits: smaller images, less JavaScript, careful third parties and real HTML on first load. Measure with real-user data, fix the biggest problems first and protect your gains with a budget. If your site feels slow, get in touch for a performance review.