How to Fix Slow Time to First Byte (TTFB) on Your Website
Time to First Byte (TTFB) is the time between a browser requesting a page and receiving the first byte of the response. Our audit takes the median TTFB across all crawled pages, measured from our audit server. By the end of this guide you will have measured where the delay comes from, added page caching and a CDN, and brought the median under 800ms.

Why it matters
Every other loading step waits on TTFB, so a slow server pushes back Largest Contentful Paint, which is part of Core Web Vitals. Crawlers, including AI crawlers that fetch pages for answers, also slow down or fetch fewer pages when responses are consistently slow, so deep pages get refreshed less often. 5-second server delay as a blank screen, which increases bounce rates.
A median under 800ms is passing, 800-1800ms is a warning, and anything above 1800ms fails.
What you need
Step-by-step fix
Measure a baseline on several page types
Test the homepage, a category or blog listing page, and a few deep pages, because the audit uses the median across all crawled pages, not just the homepage. Run each URL 3-5 times; the first request may be a cache miss. Write down the time_starttransfer value, which is the TTFB in seconds.
If deep pages are much slower than the homepage, your cache is probably only warm for popular URLs.
for u in https://example.com/ https://example.com/blog/ https://example.com/products/widget/; do
for i in 1 2 3; do
curl -o /dev/null -s -w "$u TTFB: %{time_starttransfer}s\n" "$u"
done
doneBreak the delay down to find the bottleneck
Use curl's timing breakdown to see whether time is spent on DNS, connection, TLS or the server generating the page. Subtract tls from ttfb to get roughly how long your server spent building the response.
- High DNS (>100ms): switch to a faster DNS provider or your CDN's DNS.
- High connect/TLS (>200ms): the server is far away; a CDN fixes this.
- High server time (>500ms): the page is being built on every request; caching fixes this.
curl -o /dev/null -s -w "dns: %{time_namelookup}\nconnect: %{time_connect}\ntls: %{time_appconnect}\nttfb: %{time_starttransfer}\ntotal: %{time_total}\nredirects: %{num_redirects}\n" -L https://example.com/Turn on full-page caching at the origin
Full-page caching stores the finished HTML so the server skips PHP/database work on repeat requests. On managed WordPress hosts this is usually a toggle (for example a "Caching" or "Performance" menu in the host dashboard); otherwise use a plugin such as WP Rocket, W3 Total Cache or LiteSpeed Cache on LiteSpeed servers. On your own Nginx server, use FastCGI caching and bypass the cache for logged-in users, carts and admin pages.
# In the http {} block
fastcgi_cache_path /var/cache/nginx levels=1:2 keys_zone=EXAMPLE:100m inactive=60m max_size=1g;
fastcgi_cache_key "$scheme$request_method$host$request_uri";
# In the server {} block
set $skip_cache 0;
if ($request_method = POST) { set $skip_cache 1; }
if ($http_cookie ~* "wordpress_logged_in|woocommerce_items_in_cart|comment_author") { set $skip_cache 1; }
if ($request_uri ~* "/wp-admin/|/cart/|/checkout/|/my-account/") { set $skip_cache 1; }
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass unix:/run/php/php8.3-fpm.sock;
fastcgi_cache EXAMPLE;
fastcgi_cache_valid 200 301 60m;
fastcgi_cache_bypass $skip_cache;
fastcgi_no_cache $skip_cache;
add_header X-Cache-Status $upstream_cache_status;
}Speed up uncached requests
Cache misses still happen after updates and on rarely visited pages, so make the backend itself faster.
- Upgrade to a supported PHP version (8.3 or 8.4) and confirm OPcache is enabled (
php -i | grep opcache.enable). - Add a persistent object cache such as Redis so repeated database queries are kept in memory.
- Deactivate plugins, apps or middleware that make external API calls during page render.
- Check slow queries with Query Monitor (WordPress) or your database slow query log.
sudo apt install redis-server php8.3-redis sudo systemctl enable --now redis-server # WordPress: install the "Redis Object Cache" plugin, then wp redis enable
Put a CDN in front and cache HTML at the edge
A CDN serves responses from locations near the requester, which removes most connection and TLS latency. Most CDNs only cache images, CSS and JS by default, so you must explicitly allow HTML caching. In Cloudflare go to Caching > Cache Rules > Create rule, match your hostname, exclude paths like /wp-admin, /cart and /checkout and requests with login cookies, set Cache eligibility to "Eligible for cache" and set an Edge TTL.
Make sure your origin sends a Cache-Control header that permits shared caching.
Cache-Control: public, max-age=0, s-maxage=3600, stale-while-revalidate=86400
Tune the connection layer
Small protocol settings shave off round trips on every request. 3 and keep-alive. In Cloudflare these are under Speed > Optimization > Protocol Optimization and SSL/TLS > Edge Certificates.
3;`.
server {
listen 443 ssl;
http2 on;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 1d;
keepalive_timeout 65;
server_name example.com;
}Upgrade hosting if server time is still high
If uncached responses still take more than a second after caching and backend tuning, the server lacks CPU, memory or fast storage. Move from shared hosting to a managed host or VPS with dedicated CPU, NVMe storage and a data center close to most of your visitors. Ask your current host whether your account is being CPU-throttled before migrating; the control panel often shows resource limits being hit.
Re-test the median across many pages
Clear your caches, let them warm (or run a preload), then repeat the curl loop from Step 1 across at least 10-20 URLs from your sitemap and take the middle value. Check that response headers show cache hits, such as cf-cache-status: HIT or X-Cache-Status: HIT. Then re-run our audit; it will report the new median TTFB across all crawled pages.
curl -s https://example.com/sitemap.xml | grep -oP '(?<=<loc>)[^<]+' | head -20 | while read u; do
curl -o /dev/null -s -w "%{time_starttransfer}\n" "$u"
done | sort -n | awk '{a[NR]=$1} END {print "Median TTFB:", a[int(NR/2)+1] "s"}'Platform-specific notes
WordPress
Use your host's built-in page cache if available, otherwise a cache plugin with preloading. Cloudflare's Automatic Platform Optimization (APO) for WordPress caches HTML at the edge and bypasses logged-in users automatically, which is simpler than writing your own cache rules. Add Redis object caching for WooCommerce stores.
Shopify
Hosting and CDN are managed by Shopify, so you cannot add server caching. Improve TTFB by removing unused apps that inject server-side code, simplifying Liquid templates (avoid large nested loops over collections and all_products), and reducing the number of sections on heavy templates. Measure with the Online Store > Themes > theme speed report and curl.
Wix and Squarespace
Both run on their own CDN and server infrastructure; there is no cache or hosting setting to change. TTFB is mostly affected by page complexity, so reduce heavy apps, dynamic dataset lists and very long pages. If the median stays above 800ms, there is little more you can change on these platforms.
Next.js
Avoid rendering every request dynamically. Use static generation or Incremental Static Regeneration by adding `export const revalidate = 3600` to App Router pages, and avoid calling `cookies()` or `headers()` in pages that don't need them, because that forces dynamic rendering. On Vercel or Netlify, cached pages are served from the edge automatically.
Cloudflare
HTML is not cached by default (cf-cache-status shows DYNAMIC). Create a Cache Rule to make HTML eligible for cache, with bypass conditions for login and cart cookies. Enabling Tiered Cache under Caching > Tiered Cache reduces how often edge locations go back to your origin.
Check that it worked
✅ How to verify
- Run `curl -o /dev/null -s -w "%{time_starttransfer}\n" https://example.com/` several times; repeat requests should be well under 0.8s.
- Check response headers with `curl -sI https://example.com/` for `cf-cache-status: HIT`, `X-Cache-Status: HIT` or your host's equivalent.
- Run a WebPageTest test from a location far from your server and confirm the TTFB in the first-view waterfall is under 800ms.
- Re-run our audit and confirm the median TTFB across crawled pages is under 800ms.
⚠️ Common mistakes
- Testing only the homepage. The audit uses the median across all crawled pages, so slow product, blog or category templates can keep the result failing even when the homepage is fast.
- Adding a CDN that only caches static files. Without an HTML cache rule, every page request still travels to the origin and TTFB barely changes.
- Caching pages for logged-in users or carts, which can show one customer's data to another. Always bypass the cache on session, login and cart cookies and on account and checkout paths.
- Stacking multiple page-cache plugins or layers that conflict, causing cache misses or stale pages. Use one origin page cache plus one CDN.
Is this still an issue on your site? Run a free audit — ZORO checks this and 294 other SEO, AI-visibility, accessibility and security signals, with fixes for your platform.
Check my site freeFAQ
What is a good TTFB?
Under 800ms is good for the median across your pages, which matches Google's Core Web Vitals guidance. Well-cached pages served from a CDN typically achieve 100-300ms. Above 1800ms is considered poor.
Why is my TTFB fast in my browser but slow in the audit?
Your browser may be hitting a warm cache or a nearby server, and you may be testing only a few popular pages. The audit measures from its own server location and includes deep pages that may not be cached, so distance and cache misses show up there.
Does TTFB directly affect Google rankings?
TTFB is not a Core Web Vital on its own, but it delays Largest Contentful Paint, which is. A slow server also reduces how many pages Googlebot crawls, so new and updated content is picked up more slowly.
Will a CDN fix TTFB on its own?
Only partly, unless it caches HTML. A CDN that only caches images and scripts reduces connection time but still waits for your origin to build each page. You need HTML edge caching or a fast origin cache to see a large improvement.
How to Fix Total Page Weight: Get Your Homepage Under 2 MB
How to Fix Cumulative Layout Shift (CLS) on Your Website
How to Fix Render-Blocking Resources on Your Website
How to Fix Interaction to Next Paint (INP) Above 200ms
How to Fix Unminified CSS and JavaScript Files on Your Site
How to Fix a Slow Largest Contentful Paint (LCP) on Mobile