completefrontend

Why is my website slow, and how do you fix it?

A slow site usually comes down to a few causes. Here's how to find yours from real visits, which Core Web Vital points where, and which fix to make first.

Title card: why is my website slow, and how do you fix it, with four steps in a row: real visits, the failing metric, its biggest part, and fix then measure

Your car starts making a strange noise. A good mechanic doesn't swap parts until it stops. They ask when it happens, listen with the engine running, and fix the loudest problem first. A slow website deserves the same patience.

Most websites are slow for a handful of reasons: the server answers late, the main image is found or downloaded late, files hold back the first paint, too much JavaScript keeps the page busy, or content jumps around as it loads. To find yours, check what real visitors get, see which Core Web Vital fails, and fix the biggest part of that one first. The checklist below goes in that order.

Is your website actually slow?

Start with real visits, not your own computer. Your laptop on office Wi-Fi is fast. Most people browse on mid-range Android phones and slow networks, so a page that feels instant to you can take seconds for them. The performance inequality gap shows how wide that difference is.

Put your address into PageSpeed Insights. Its top section is field data from the Chrome User Experience Report: real Chrome visits over the last 28 days, with phones and computers shown separately. It rates each Core Web Vital at the 75th percentile, which means three visits in four were that fast or faster.

Metric What it measures Good Poor
LCP When the biggest image or text appears 2.5 s or less Over 4 s
INP How fast the page answers a tap, click, or key 200 ms or less Over 500 ms
CLS How much the page jumps 0.1 or less Over 0.25

The page passes only when all three are good. The 0 to 100 score further down is something else: a single lab load on a pretend phone, with a slow 4G network and a CPU four times slower than the test machine. It helps you find causes, but it doesn't decide whether you pass. Lab data vs field data explains why the two often disagree, and PageSpeed Insights and Search Console shows how to read each section.

If your site gets too few visits for Chrome's report, some or all of the field data will be missing. A missing number isn't a pass. Measure your own visits with the web-vitals library, or test on a real mid-range phone.

Which Core Web Vital is failing?

Each metric points at a different part of the page, so the one that fails tells you where to look. If more than one fails, start with the one where the most visits are past the line.

Three columns of checks: for a slow LCP, check the server, a main image found late, a heavy main image, and render-blocking files; for a slow INP, check long tasks, third-party scripts, slow handlers, and big updates; for a high CLS, check images without a size, ads without a slot, content added near the top, and late web fonts
Find the failing metric, then check the causes in its column

If LCP is slow, where does the time go?

LCP splits into four parts, one after the other: the time to first byte, the wait before the browser starts fetching the main image, the download, and the wait until it's painted. The four parts of LCP shows how to read them in DevTools. The biggest part tells you which of these checks to start with.

The server answers late

Time to first byte (TTFB) is everything before the first byte of HTML arrives: redirects, DNS, the connection, and the server's own work. Good is 0.8 seconds or less, and every later metric waits for it. Remove redirects, cache the HTML where you can, and serve it from a CDN close to your visitors. See Time to first byte and CDNs and the edge.

The main image is found late

If a script adds the image, or it's a CSS background, or it's lazy-loaded, the browser can't start downloading it early. Put it in the HTML as a normal image with a src, mark it high priority, and never lazy-load it:

<img src="/images/hero.avif" width="1200" height="675"
     fetchpriority="high" alt="A cup of mint tea on a wooden table">

Give fetchpriority="high" to the main image only. On every image, the hint backfires. Load the LCP resource early covers the cases where only CSS or a script can name the image.

The main image is too heavy

A huge photo takes a long time to cross a slow network. Use a modern format, and let srcset send a size that fits the screen. See Image formats and Responsive images.

Something holds back the first paint

A stylesheet in the head holds back the first paint until it arrives. A classic script in the head stops the HTML parser until it has downloaded and run. Load scripts with defer, and link each stylesheet in the HTML instead of chaining @import lines. See Render-blocking and parser-blocking resources.

If INP is slow, what keeps the page busy?

A slow tap means the page's main thread had too much to do. Other code was running when the tap came, the tap's own handler ran long, or the update after it was too big. Look for these:

  • Long tasks from too much JavaScript. A task that runs for more than 50 ms is a long task, and every tap waits behind it. How much JavaScript is too much? shows how to set a limit.
  • Third-party scripts. Tag managers, ads, and chat widgets run on the same main thread as your code. The cost of third parties measures each one on its own.
  • Slow handlers. Show feedback first, then do the slow part after the next paint.
  • Big updates. Change only the part of the page the tap needs, not a whole list.

What is Interaction to Next Paint? walks through finding and fixing one slow tap.

If CLS is high, what made room?

The page jumps when something takes new room after the first paint. Chrome tells you what moved, not what made it move, so look just above or beside the first thing that moved. Check for these:

  • Images and videos without width and height. Add them, or a CSS aspect-ratio, so the space is kept before the file arrives.
  • Ads and embeds that land in an empty slot. Keep the slot open with min-height.
  • Banners and notices added near the top. Keep a place for them, or lay them over the page.
  • Web fonts that arrive late and change how much room the words take. Use a fallback font sized to match.
  • Animations of top, left, width, or height. Use transform instead.

What causes layout shifts and Fixing layout shifts go through each one.

Which fix should come first?

Not the loudest complaint, and not the worst number. Pick the fix that brings the most visits under the line for each hour of work. A small fix on the page most phone visitors land on can matter more than a big fix on a page few people open. Running a performance audit ranks fixes exactly this way.

Make one change at a time, and measure again. Check LCP itself, not just the part you fixed, because a shorter part can simply push its time into the next one. Then wait for the field data. Chrome's report covers 28 days, so the full effect shows up over weeks, not the next morning. Proving a change worked shows how to compare before and after honestly.

Once it's fast, keep it fast. A performance budget checked on every pull request catches the next heavy image before it ships.

Where to go next