Table of Contents
- Why Website Speed Matters
- Core Web Vitals Explained
- Measuring Website Speed
- Image Optimization
- JavaScript Optimization
- CSS Optimization
- Server and Hosting Optimization
- Caching Strategies
- CDN Implementation
- Font Optimization
- Third-Party Script Management
- Platform-Specific Optimization
- Frequently Asked Questions
Why Website Speed Matters
SEO Impact
Google uses page speed as a ranking signal. Slow pages get crawled less frequently, consuming more of your crawl budget. Core Web Vitals affect your page experience score which influences rankings. Mobile speed is especially important given mobile-first indexing. Faster sites earn more organic traffic simply by ranking higher.
Conversion Impact
| Load Time Impact | Statistic | Source |
|---|---|---|
| 1-second delay | 7% fewer conversions | Google/Akamai |
| 3-second load time | 53% of mobile users abandon | |
| 100ms Amazon delay | 1% fewer sales | Amazon |
| Walmart 1s improvement | 2% more conversions | Walmart |
| Top 10% fastest sites | Load under 1 second | Google CRUX |
Core Web Vitals Explained
Largest Contentful Paint (LCP)
LCP measures how long it takes for the largest content element to become visible in the viewport. Target: under 2.5 seconds. Common causes of slow LCP include slow server response times, render-blocking JavaScript and CSS, unoptimized images, and client-side rendering without pre-rendering.
Cumulative Layout Shift (CLS)
CLS measures unexpected layout shifts during page loading. Target: under 0.1. Common causes include images without dimensions specified, dynamically injected content, web fonts causing text reflow, and ads or embeds that push content. Always specify width and height for images and use font-display: swap.
Interaction to Next Paint (INP)
INP measures how quickly a page responds to user interactions (clicks, taps, key presses). Target: under 200ms. Replaced First Input Delay (FID) in March 2024. INP measures the worst interaction latency throughout the entire page lifecycle. Reduce INP by optimizing JavaScript execution, reducing main thread blocking, and using web workers for heavy computations.
Measuring Website Speed
| Tool | Data Type | Best For |
|---|---|---|
| PageSpeed Insights | Field data (real users) | Overall Core Web Vitals assessment |
| Lighthouse | Lab data (controlled) | Detailed performance audit |
| WebPageTest | Lab data (multi-location) | Waterfall analysis, filmstrip |
| GTmetrix | Lab data | Performance grades, YSlow scores |
| Chrome DevTools | Lab data (local) | Real-time profiling, network tab |
| Search Console | Field data | Core Web Vitals report by URL |
Image Optimization
Images are typically the largest assets on web pages and the biggest opportunity for speed improvement. Convert all images to WebP format (30% smaller than JPEG). Implement responsive images with srcset serving appropriately sized images for each device. Use lazy loading for below-fold images. Specify width and height attributes to prevent layout shifts. Consider using CDN-based image optimization services that automatically optimize, resize, and convert images on the fly.
JavaScript Optimization
Excessive JavaScript is the primary cause of slow page load and poor Core Web Vitals. Reduce JavaScript bundle size through code splitting (load only what is needed for each page). Use dynamic imports for non-critical code. Tree-shake unused code in your build process. Defer non-essential scripts. Remove unused third-party scripts. Use web workers for computationally intensive tasks. Monitor JavaScript size with bundle analyzers.
CSS Optimization
Critical CSS should be inlined in the HTML head for first-screen rendering. Non-critical CSS should be loaded asynchronously. Minify all CSS files. Remove unused CSS rules (purge CSS). Avoid CSS @import which blocks rendering. Use efficient CSS selectors. Consider CSS containment for isolated components.
Server and Hosting Optimization
Server response time (Time to First Byte) directly impacts LCP. Use quality hosting with adequate resources. Implement server-side caching (Redis, Memcached). Use HTTP/2 or HTTP/3 for multiplexed connections. Enable Brotli or Gzip compression for all text resources. Optimize database queries. Use serverless functions for dynamic content that does not need a full server process.
Caching Strategies
Implement browser caching with appropriate Cache-Control headers for static assets (images, CSS, JS) with long expiration times. Use server-side caching for dynamic content. Implement CDN caching with proper cache invalidation. Cache-first strategy for static assets, network-first for dynamic content. Use service workers for advanced caching strategies in Progressive Web Apps.
CDN Implementation
A Content Delivery Network distributes your static assets across global edge servers, serving content from the nearest location to each visitor. Cloudflare offers a robust free tier. Configure your CDN with proper cache rules, origin shield, and Brotli compression. CDN reduces latency by 50-80% and handles traffic spikes effectively.
Font Optimization
Web fonts are a common source of layout shifts and slow rendering. Use font-display: swap to prevent invisible text. Preload critical fonts with a link rel preload tag. Subset fonts to include only used characters. Use variable fonts to reduce the number of font files. Consider system font stacks for maximum performance.
Third-Party Script Management
Third-party scripts (analytics, chat widgets, ads, social embeds) significantly impact performance. Audit and remove unnecessary third-party scripts. Load non-essential scripts asynchronously or with requestIdleCallback. Use Partytown or similar tools to run third-party scripts in web workers. Implement consent management that blocks tracking scripts until user consent.
Platform-Specific Optimization
WordPress: Use caching plugin (WP Rocket), optimize database, limit plugins, use quality hosting. Shopify: Optimize theme, compress images, limit apps. Next.js: Use SSG/SSR, next/image, Server Components. WooCommerce: Product image optimization, caching, quality hosting. Each platform has specific speed optimization tools and best practices.
Frequently Asked Questions
How often should I test my website speed?
Test speed monthly with Lighthouse and weekly with real-user monitoring in Google Search Console. Test after any significant changes (new plugins, code deployments, design updates). Set up speed monitoring alerts for when Core Web Vitals drop below thresholds.
What is the difference between TTFB and LCP?”,
TTFB (Time to First Byte) measures how long the server takes to respond to the initial request. LCP (Largest Contentful Paint) measures when the main content becomes visible, which includes TTFB plus resource loading and rendering time. TTFB is a server metric; LCP is a user experience metric. Optimize TTFB for better LCP.
Does page speed affect mobile more than desktop?
Yes. Mobile devices have less processing power, slower network connections, and stricter performance thresholds in Google’s evaluation. Core Web Vitals thresholds are the same for mobile and desktop, but achieving them on mobile is harder. Prioritize mobile speed optimization given mobile-first indexing.