HTTP, TLS & Web Performance

Why Websites Load Slowly

Find the real causes of slow pages, from distant servers and heavy images to blocking scripts, and learn how to tell which one is hurting you.

Key takeaways

  • Page speed depends on latency, server response time, file weight, loading order and the work your device must do.
  • Many small sequential requests suffer more from latency than from limited bandwidth.
  • Oversized images, heavy JavaScript and third-party tags are among the most common causes.
  • Browser developer tools show where the time goes, so measure before changing anything.
  • Visitors can rule out their own connection and device, but most fixes belong to the site owner.

A web page is slow when the browser has to wait too long for something before it can show or respond: a distant or overworked server, files that are too large, too many things loaded in sequence, or scripts that keep the processor busy. Often several of these stack up.

More bandwidth fixes only some of them. This guide walks through each cause, how to recognize it, and what to do whether you're a visitor or run the site.

The journey of a page load

Loading a page is a chain of dependent steps. The browser looks up the address, connects, sets up encryption, requests the HTML and waits for it. As the HTML arrives, it discovers stylesheets, scripts, fonts and images, requests those, and sometimes learns from them about still more files. Then it has to turn everything into pixels.

Where time goes during a page load
1 Look up and connect DNS, transport and TLS setup 2 Wait for the server Time until the first byte arrives 3 Fetch key resources Styles, scripts, fonts and main image 4 Render Build the layout and paint it 5 Become responsive Scripts finish and taps get answered Look up and connect DNS, transport and TLS setup 1 Wait for the server Time until the first byte arrives 2 Fetch key resources Styles, scripts, fonts and main image 3 Render Build the layout and paint it 4 Become responsive Scripts finish and taps get answered 5

A delay early in the chain pushes back everything after it. That is why a slow first response hurts more than one slow image near the bottom of the page.

Distance and latency

Latency is the time a message takes to travel to the server and back. It has a floor set by physics and by the route the data takes. Opening a new connection needs several round trips before any content moves, so a faraway server feels sluggish even on a fast line. Latency limits explains why upgrades to bandwidth don't remove it.

Bandwidth still matters for large downloads. But for a typical page made of many modest files, trimming round trips often helps more.

The usual remedy is a content delivery network, which keeps copies of files on servers near visitors. Newer protocols help too: HTTP/2 and HTTP/3 send many requests over one connection.

Slow server responses

Time to first byte (TTFB) measures how long it takes from starting a request until the response begins to arrive. If it's high even for nearby visitors, the server is likely doing too much work:

  • Database queries without suitable indexes.
  • Building the same page from scratch for every visitor.
  • Calling outside services and waiting for each in turn.
  • Underpowered or crowded hosting.
  • Too few workers, so requests queue.

Caching finished pages or expensive query results usually gives the biggest gain. Measure on the server side to find the slow part; traces and logs make that concrete.

Redirects add to this wait. A chain from http://example.com to https://example.com to https://www.example.com/home costs extra round trips before the real page even starts.

Files that are too big

Images are frequently the heaviest part of a page. Typical mistakes include uploading a camera original to fill a small box, using PNG for photographs, and shipping the same huge file to phones and desktops.

Fix them by resizing to the displayed size, choosing an efficient format and compressing sensibly. See image formats for speed, or try the image compressor. Load offscreen images later with lazy loading, but never delay the main image at the top.

Text files such as HTML, CSS and JavaScript should be sent compressed. Gzip and Brotli shrink them substantially, and it's usually a server setting.

Video that autoplays and web fonts in many weights add up too.

Loading order and blocking

Some files stop the browser from showing anything until they arrive. Stylesheets in the page head block rendering. A classic script tag without defer or async pauses HTML parsing while it downloads and runs. See render-blocking resources.

Request chains are subtler. The HTML loads a stylesheet, which imports another, which references a font. Each link waits for the previous one. Flattening chains, or preloading a critical file, lets downloads happen in parallel.

Pages that build all their content with JavaScript have the longest chain: download the code, run it, request data, then draw. Sending meaningful HTML from the server shortens that path.

Too much JavaScript

Downloading a script is only part of its cost. The browser must also parse, compile and run it, mostly on a single main thread that also handles your taps and scrolling. On a budget phone, code that feels instant on a developer's laptop can freeze the page.

Signs include a page that looks ready but ignores input, jerky scrolling and a warm, busy device. Remedies: ship less code, split it so each page loads only what it needs, break long tasks into smaller pieces and delete libraries you barely use.

Third parties

Analytics, advertising, chat widgets, social buttons, video embeds, consent banners and testing tools each add requests to other companies' servers, and many add more of their own. You don't control their speed.

Audit them regularly. For each one, ask who uses its output. Remove the unused ones, load the rest without blocking, and consider showing a lightweight placeholder for heavy embeds until someone clicks.

Caching that isn't happening

A returning visitor shouldn't download unchanged files again. If your server sends no useful caching headers, the browser has to ask each time. Long cache lifetimes combined with versioned filenames solve this for static assets; see Cache-Control headers.

The visitor's device and network

The same page can behave very differently from one person to the next. Processor speed decides how long scripts and layout take. Limited memory forces the browser to discard and reload background tabs. A weak Wi-Fi signal causes retransmissions that look like a slow server, and a congested mobile cell can swing from quick to crawling within minutes.

Browser extensions add work of their own, especially those that inspect or rewrite every page. So can security software that scans downloads. And when someone else on the connection is uploading a large file, delay for everyone can rise sharply, a problem described in bufferbloat.

As a site owner, you can't fix a visitor's hardware, but you can design for it. Assume a mid-range phone on an imperfect network, send less, and make the page useful before every extra has arrived. Text that can be read early, buttons that work without waiting for the whole script bundle and images that appear progressively all make a slow connection tolerable.

Where to start fixing

Rank work by effect and effort. These usually pay off early:

  1. Turn on text compression and sensible caching headers.
  2. Resize and compress the largest images, especially the one at the top.
  3. Remove unused third-party tags and plugins.
  4. Cache expensive pages or queries on the server.
  5. Add defer to scripts that don't need to run immediately.
  6. Put static files on a CDN if your audience is spread out.

After each change, measure again under the same conditions. Some fixes that sound important barely register on a particular site, and the waterfall will tell you which ones those are. Once things are fast, set limits on page weight and request count so new features don't quietly undo the work.

Diagnosing it

Narrowing down a slow site
Are all sites slow for you? YES Check your Wi-Fi, connection speed and other devices using it. 1 NO Is the time to first byte long? YES Look at distance, server work, redirects and page caching. 2 NO Are large files dominating the download? YES Resize, compress and defer images, video and fonts. 3 NO Does content appear late despite early downloads? YES Remove render blocking and request chains. 4 NO Check script work Profile the main thread and third-party code. Are all sites slow for you? 1 IF YES Check your Wi-Fi, connection speed and other devices using it. NO Is the time to first byte long? 2 IF YES Look at distance, server work, redirects and page caching. NO Are large files dominating the download? 3 IF YES Resize, compress and defer images, video and fonts. NO Does content appear late despite early downloads? 4 IF YES Remove render blocking and request chains. NO Check script work Profile the main thread and third-party code.

Open developer tools, go to the Network panel, tick the option to disable cache and reload. The waterfall chart shows each request, when it started and what it waited for. Look for a long bar at the top, big files, long staircases and a late-starting main image. Apply network and processor throttling to approximate a modest phone.

From a terminal you can time the first stages:

curl -so /dev/null -w "dns %{time_namelookup}\nconnect %{time_connect}\ntls %{time_appconnect}\nfirst byte %{time_starttransfer}\ntotal %{time_total}\n" https://example.com/

The values are cumulative seconds from the start. A full performance audit adds field data from real visitors, and Core Web Vitals gives you named targets.

If you're just trying to use the site

Test another website. Run a speed test near the router and with a cable if you can. Close downloads and cloud backups. Restart the browser, disable extensions temporarily and compare another device. Clearing the cache rarely speeds anything up, since it forces fresh downloads, though it can fix a corrupted file. If only one site is slow everywhere, it's their problem.

Common questions

Will faster hosting fix everything?

It helps if server response time is the bottleneck. It does nothing for a huge image or a script that locks up a phone.

Why is my site fast for me and slow for others?

You probably have a good device, a nearby server, a warm cache and a fast line. Test with an empty cache, throttling and real visitor measurements.

Is a smaller page always faster?

Usually, but order matters as well. A modest page with a long chain of blocking requests can feel slower than a heavier one that shows its content first.

Written for 4Internet with AI writing tools and not reviewed line by line by a person. Check anything you rely on with the maker, provider or standard concerned. Report an error.

Keep reading

All 45 articles in HTTP, TLS & Web Performance →

Latest news on this topic