Why is my website slow, and how do I fix it?
"Let's switch hosting" should not be the first answer to a slow site. Measure first, then find the cause. Here is how to measure, the six usual suspects, and two checklists: one for the owner, one for the developer.
“Our site is slow” is one of the sentences I hear most. It usually comes with one of two proposals: move to another host, or rebuild the whole thing. Most of the time neither is needed. What is needed is a measurement, so you know where the time actually goes.
This post is for both sides: the person who owns the site and the developer who has to fix it.
Measure before you argue
“Slow” is not a feeling. It is a number. Three tools are enough.
PageSpeed Insights (pagespeed.web.dev) gives you two kinds of results:
- Field data. What real Chrome users experienced on your site over the previous 28 days, taken from the Chrome User Experience Report (CrUX). New or low-traffic sites often have none.
- Lab data. Lighthouse loads the page on a simulated mid-range phone on a mobile network. Great for finding causes, but it does not see everything real visitors see.
Search Console has a Core Web Vitals report. It groups similar pages and labels each group Good, Needs improvement or Poor, using real-user data. Not enough traffic means an empty report.
Chrome DevTools. Press F12, open Network, reload, and click the first HTML request. “Waiting for server response” is how long your server thought before answering. Lighthouse is in its own tab right there too.
What Google looks at: Core Web Vitals
Google boils speed down to three metrics. The goal is to be in the Good range for at least 75% of visits, measured separately for mobile and desktop.
| Metric | What it measures | Good | Needs improvement | Poor |
|---|---|---|---|---|
| LCP (Largest Contentful Paint) | When the main content shows up | 2.5 s or less | 2.5 to 4 s | over 4 s |
| INP (Interaction to Next Paint) | How fast the page reacts to taps and clicks | 200 ms or less | 200 to 500 ms | over 500 ms |
| CLS (Cumulative Layout Shift) | How much the page jumps while loading | 0.1 or less | 0.1 to 0.25 | over 0.25 |
INP replaced FID in March 2024. If an article still talks about FID as a Core Web Vital, it is out of date.
Then there is TTFB, time to first byte: from the moment the browser asks until the first byte of HTML arrives. It includes redirects, DNS, connecting, TLS and the server’s own work. It is not a Core Web Vital, but every other metric sits on top of it. Good is 0.8 seconds or less. Over 1.8 seconds is poor.
To be honest about rankings: Google treats these as part of page experience, something its ranking systems aim to reward. A fast site does not jump to the first position by itself. A slow site does lose points, with Google and with the person holding the phone.
The usual suspects
The order goes from the server to the browser, because if the first byte is late, everything after it is late too.
1. The server answers slowly (TTFB)
If the first byte takes two seconds, the whole page is two seconds behind before anything else starts. No image optimization will save that.
While writing this, I measured my own site. Five requests from the same server it runs on. The home page delivered its first byte in 0.60 to 3.08 seconds. The /about/ page in 0.15 to 0.26 seconds. Same server, same network, no distance at all. So the difference is the work the server does to build that page. My own home page sits in Needs improvement, and I would not have known without measuring.
The common server-side causes:
- Cheap or overloaded hosting. On shared hosting your site shares a CPU with hundreds of others.
- Wasted database queries. In Django the classic one is the N+1 problem, shown below.
- No caching. The same page is rebuilt from scratch on every visit even though its content changes once a day.
- Redirect chains. http to https to www to a language prefix. Every hop is another round trip.
This is what N+1 looks like. A page showing 20 listings:
listings = Listing.objects.filter(is_active=True)[:20]
for listing in listings:
print(listing.agent.name, listing.district.name)
One query for the listings, then one query per listing for the agent and one for the district. 41 queries. The fixed version:
listings = (
Listing.objects.filter(is_active=True)
.select_related("agent", "district")
.prefetch_related("photos")[:20]
)
select_related pulls ForeignKey and OneToOne relations into the same query with a SQL JOIN. prefetch_related fetches many-to-many and reverse relations in one extra query and joins them in Python. 41 queries become two or three.
2. Images
According to HTTP Archive’s 2024 Web Almanac, the median mobile page weighs about 2.3 MB. On mobile home pages the median is 900 KB of images and 558 KB of JavaScript. Images are the biggest slice.
The classic mistakes:
- A 4000-pixel, 5 MB photo straight from a phone, shown in a 400-pixel card.
- PNG for photos.
- The big image at the top (usually the LCP element) loaded with
loading="lazy", so the browser starts it late.
Google says lossless WebP is 26% smaller than PNG and lossy WebP is 25 to 34% smaller than JPEG at the same quality. AVIF is often smaller still, but test both.
The rule: resize to the size it is displayed at, convert to WebP or AVIF, always set width and height (that is CLS), lazy-load what is below the fold, and give the main image at the top fetchpriority="high" instead.
3. JavaScript, CSS and third-party scripts
Every “small” addition has weight: a live chat widget, two or three analytics tags, ad pixels, social buttons, an embedded map. Each loads from someone else’s server, and you do not control that server.
They hurt in two places:
- Loaded synchronously in
<head>, they block the page from rendering (worse LCP). - After load, they keep the browser’s main thread busy, so taps feel frozen (worse INP).
What to do: ask of every script, “what does this earn us?” No answer, delete it. Add defer or async to the rest. Load heavy widgets (chat, maps, video) only when the user scrolls near them or clicks.
4. Caching, compression and CDN
- Cache static files. CSS, JS, images and fonts should go out with a long
Cache-Controllifetime and a versioned file name, so repeat visits do not download them again. - Compression. HTML, CSS and JS should be gzip or Brotli compressed. In nginx that is a few lines.
- CDN. Serves static files from a server close to the visitor.
5. Fonts
Two font families in four weights, each a separate file. And without font-display, the browser may hide text until the font arrives.
The rule: WOFF2 only, drop the weights you do not use, set font-display: swap or optional, and preload the one or two fonts that matter. If your audience reads Azerbaijani, check the font actually has ə, ğ, ı, ö, ü, ç and ş. Otherwise those letters fall back to another font and the text jumps.
6. The server is far from your visitors
You cannot cheat physics. On a fresh HTTPS connection the browser makes several round trips before it gets the first byte: TCP, the TLS handshake, then the request itself. The farther the server, the more each trip costs.
Most sites serving Azerbaijan are hosted in Europe (mine is in Frankfurt), and that is fine. But if the server is in the US and every customer is in Baku, moving the server or putting static files on a CDN makes sense.
Checklist for the owner
- Run PageSpeed Insights on the home page and your one or two most important pages. Look at mobile.
- Open the Core Web Vitals report in Search Console. Which page groups are Poor?
- List every third-party service on the site: chat, analytics, pixels, widgets. Know why each one is there.
- Check the size of uploaded images. Anything over 1 MB is a problem.
- Ask your developer for numbers: what is the TTFB, what is the LCP element, how many SQL queries does the page run?
- Measure again after every change. Field data takes 28 days to fully catch up, so be patient.
Checklist for the developer
- Measure TTFB (
curl -w "%{time_starttransfer}"or DevTools). Over 0.8 seconds, start there. - In Django, count queries with
django-debug-toolbar. Find the N+1s, addselect_relatedandprefetch_related. - Cache pages and fragments that rarely change.
- Collapse redirect chains into a single hop.
- Find the LCP element. If it is an image: right size, WebP or AVIF,
fetchpriority="high", no lazy loading. - Put
widthandheighton every image. - Cut render-blocking CSS and JS.
deferyour scripts, delay third-party ones. - Long cache headers on static files, gzip or Brotli, a CDN if needed.
- Move fonts to WOFF2, set
font-display, drop unused weights. - Verify with PageSpeed Insights and Search Console.
Last thing
A slow site is rarely one big mistake. It is ten small decisions, each “only half a second”. The way to find them is measuring, not guessing.
This is part of a series on common technical problems in business. If your site is slow and you want to find out where it is stuck, see web development or just write to me.
Sources
- Web Vitals, web.dev
- Largest Contentful Paint (LCP), web.dev
- Interaction to Next Paint (INP), web.dev
- Cumulative Layout Shift (CLS), web.dev
- INP becomes a Core Web Vital, web.dev
- Time to First Byte (TTFB), web.dev
- Optimize Largest Contentful Paint, web.dev
- Best practices for fonts, web.dev
- Loading third-party JavaScript, web.dev
- Understanding Core Web Vitals and Google search results, Google Search Central
- Core Web Vitals report, Search Console Help
- About PageSpeed Insights, Google
- Chrome UX Report (CrUX), Chrome for Developers
- WebP, Google for Developers
- Page Weight, HTTP Archive Web Almanac 2024
- QuerySet API reference, Django
-
What is TikSocket, and is there anything like it?
2026-11-16 · 9 min
-
What is DDD, and how do you actually apply it?
2026-11-15 · 16 min
-
How to add Epoint payments to your website
2026-11-12 · 9 min