You can have the fastest JavaScript, perfectly compressed images, and a blazing CDN — but if your server takes 2 seconds to respond, your page will still feel slow. TTFB is the foundation of every other performance metric. Fix it first.
What is TTFB?
Time to First Byte (TTFB) measures the time from when a browser sends an HTTP request to when it receives the first byte of the server's response. It includes:
- DNS lookup time — resolving your domain to an IP address
- TCP connection time — establishing the connection to your server
- TLS handshake time — negotiating HTTPS encryption
- Server processing time — PHP executing WordPress, database queries, generating HTML
Of these, server processing time is almost always the biggest contributor on WordPress sites — and the most fixable.
What's a good TTFB for WordPress?
- Excellent: under 200ms
- Good: 200–500ms
- Needs work: 500ms–1s
- Poor: over 1 second
Google's PageSpeed Insights (and WPStats) flags TTFB over 600ms as a "Reduce server response time" issue. For context, a well-cached WordPress site on good hosting typically achieves 80–150ms.
Step 1: Diagnose your TTFB
Before fixing anything, measure your baseline:
- WPStats — shows your TTFB from the analysis server
- Chrome DevTools → Network tab → click your HTML document → Timing → "Waiting for server response"
- WebPageTest.org → detailed TTFB breakdown by phase (DNS, connect, TLS, wait)
- GTmetrix → Waterfall tab → first row
Test from multiple locations. TTFB varies significantly by geographic distance from your server. Use WebPageTest with multiple test locations to understand your global TTFB profile.
Step 2: Enable full-page caching (biggest impact)
An uncached WordPress page requires PHP to execute, run 30–100+ database queries, and render HTML — all before sending a single byte. A cached page is served as a static HTML file: response time drops from 500ms–2s to under 50ms.
This is the single most impactful TTFB improvement for most WordPress sites.
Best caching plugins by hosting type:
- LiteSpeed hosting → LiteSpeed Cache (free, best performance)
- Nginx/Apache on VPS → WP Rocket, W3 Total Cache with Nginx FastCGI cache
- Managed WordPress hosting → Use the built-in server-level cache (Kinsta, WP Engine, Flywheel all have this)
- Cloudways → Breeze (free, optimized for Cloudways) + Redis object cache
Step 3: Add object caching with Redis or Memcached
Even with page caching enabled, dynamic pages (WooCommerce cart, logged-in users, search results) can't be fully page-cached. Object caching stores the results of expensive database queries in RAM, dramatically reducing query time for these requests.
Setting up Redis on WordPress:
# On Ubuntu/Debian server
sudo apt install redis-server php-redis
# Then install the WordPress plugin:
# "Redis Object Cache" by Till Krüss
After installing the plugin, go to Settings → Redis and click "Enable Object Cache." You should see a green "Connected" status. Database-heavy pages can see 40–70% TTFB reduction with Redis.
Step 4: Optimize your PHP configuration
Use PHP-FPM with OPcache
PHP OPcache stores compiled PHP bytecode in memory, eliminating the need to recompile PHP files on every request. It's included with PHP 5.5+ but may not be enabled by default.
Check if OPcache is enabled: add <?php phpinfo(); ?> to a test file and look for the OPcache section. Recommended settings in php.ini:
opcache.enable=1
opcache.memory_consumption=256
opcache.interned_strings_buffer=16
opcache.max_accelerated_files=10000
opcache.revalidate_freq=60
opcache.fast_shutdown=1
Upgrade to PHP 8.2+
PHP 8.x is significantly faster than PHP 7.x for WordPress. Switching from PHP 7.4 to PHP 8.2 typically yields 15–30% faster execution time. Check your PHP version in WordPress Admin → Tools → Site Health.
Step 5: Optimize your database
Slow database queries are a major cause of high TTFB on older or larger WordPress sites. Every uncached page load runs dozens of queries; slow ones block the entire response.
Find slow queries:
Install the Query Monitor plugin. It shows every database query per page, sorted by execution time. Anything over 100ms deserves investigation.
Quick database fixes:
- Clean up the
wp_optionstable — large autoloaded data is loaded on every request - Run
OPTIMIZE TABLEon fragmented tables via phpMyAdmin - Delete post revisions, expired transients, and spam comments
- Add index to
wp_options.autoloadcolumn if the table is large
Step 6: Upgrade your hosting
If you've enabled caching and still see TTFB over 300ms, your hosting infrastructure may be the bottleneck. Signs that you need better hosting:
- TTFB is slow even for cached pages
- Shared hosting with limited CPU/RAM
- Server located far from your target audience
Hosting tiers for TTFB:
| Hosting type | Typical cached TTFB | Cost |
|---|---|---|
| Budget shared hosting | 300–800ms | $3–8/mo |
| Quality shared hosting (SiteGround) | 100–300ms | $15–30/mo |
| Cloud VPS (Cloudways/DigitalOcean) | 50–150ms | $15–50/mo |
| Managed WordPress (Kinsta/WP Engine) | 30–100ms | $30–100/mo |
Step 7: Use Cloudflare for DNS + edge caching
Cloudflare's free tier provides:
- Faster DNS resolution — Cloudflare's 1.1.1.1 is the fastest public DNS resolver
- Edge caching — Static assets served from 250+ locations worldwide
- HTTP/2 and HTTP/3 — Faster connection establishment
- TLS termination at the edge — Reduces TLS handshake time for distant users
On Cloudflare's paid plans, you can also cache full HTML pages at the edge with Page Rules or Cache Rules, bypassing your origin server entirely.
Measuring your improvement
After implementing these changes, measure TTFB again from multiple locations. Use WPStats to get a quick read, and WebPageTest for detailed before/after waterfall comparisons. Target:
- Cached pages: under 100ms TTFB
- Uncached/dynamic pages: under 500ms TTFB
- PageSpeed "Reduce server response time" audit: passing
Pro tip: Check TTFB separately for cached and uncached pages. Browse to a post while logged out (cached) vs logged in (uncached/dynamic). The gap tells you how effective your caching is.
Check your WordPress TTFB right now
WPStats measures your server response time and PageSpeed scores instantly — free, no registration needed.
Measure my TTFB