Page speed is a confirmed Google ranking factor, and it directly affects conversion rates, bounce rates, and user satisfaction. Every 100 milliseconds of load time costs measurable revenue. Google's Core Web Vitals give you specific metrics to target and specific ways to improve them.
This guide covers every major page speed optimization technique, from the quick wins to the advanced performance engineering. Speed is tightly connected to Core Web Vitals and mobile SEO. Use the free pagespeed checker to measure your current performance before and after each change.
Understanding Core Web Vitals
Core Web Vitals are three specific metrics Google uses to measure user experience. They are part of the Page Experience ranking signal and appear in Google Search Console.
- Largest Contentful Paint (LCP): How long it takes for the largest visible element (usually a hero image or heading) to render. Target: under 2.5 seconds.
- Interaction to Next Paint (INP): How long it takes for the page to respond to user interactions like clicks and taps. Target: under 200 milliseconds.
- Cumulative Layout Shift (CLS): How much the page layout shifts unexpectedly during loading. Target: under 0.1.
Measure these on real users, not just lab tests. Chrome UX Report (CrUX) provides field data, and the pagespeed checker simulates real-world conditions.
Quick Wins: Optimize Images
Images are the single largest resource on most pages. Optimizing them delivers the biggest speed improvement with the least effort.
- Compress every image. Use tools like TinyPNG or Squoosh to reduce file sizes by 40-70% with no visible quality loss.
- Use modern formats. WebP and AVIF produce 25-50% smaller files than JPEG. Use
<picture>elements to serve WebP with JPEG fallback. - Resize to display dimensions. Do not upload a 4000px wide image to display at 800px. Resize it before uploading.
- Implement lazy loading. Add
loading="lazy"to images below the fold. Do not lazy load above-the-fold images (hurts LCP). - Use the image alt text checker to ensure every compressed image still has proper alt text for accessibility.
Minify and Optimize Code
Unnecessary code bloat increases file sizes and parsing time. Minifying HTML, CSS, and JavaScript reduces the bytes the browser needs to download and process.
- Minify CSS and JavaScript. Remove whitespace, comments, and unused code. Tools like Terser and cssnano automate this.
- Remove unused CSS. Audit your stylesheets to find rules that apply to elements not on the page. PurgeCSS can automate removal.
- Defer non-critical JavaScript. Add
deferorasyncattributes to scripts that do not need to run immediately. - Inline critical CSS. Extract the CSS needed for above-the-fold content and inline it in the HTML head. Load the rest asynchronously.
- Code split. Break large JavaScript bundles into smaller chunks that load on demand. Users should only download what they need for the current page.
Leverage Browser Caching
Caching tells the browser to store resources locally so they do not need to be re-downloaded on subsequent visits.
- Set Cache-Control headers. Use long cache lifetimes (1 year) for static assets with content-hash filenames. Use shorter lifetimes for HTML.
- Use versioned filenames. Instead of
style.css, usestyle.a1b2c3.css. This allows aggressive caching while still supporting updates. - Implement service workers for offline caching and instant page loads on repeat visits.
Enable Compression
Compression reduces the size of files sent from your server to the browser. Most servers support Gzip or Brotli compression out of the box.
- Gzip reduces file sizes by 60-80%. Enable it in your server configuration.
- Brotli offers 15-25% better compression than Gzip. Enable it if your server supports it.
- Compress HTML, CSS, JavaScript, JSON, and SVG files. Do not compress already-compressed formats like JPEG, PNG, or WebP.
Optimize Server Response Time
A fast server response (low Time to First Byte) means the browser can start downloading content sooner.
- Use a CDN. Content Delivery Networks serve files from servers closest to the user, reducing latency.
- Optimize database queries. Slow database queries increase server response time. Add indexes and optimize queries.
- Use PHP OPcache. For PHP sites, OPcache stores compiled scripts in memory, avoiding recompilation on every request.
- Choose quality hosting. Shared hosting is slow under load. Consider VPS or managed hosting for production sites.
Reduce Layout Shift (CLS)
Layout shift happens when elements move after the page starts loading. This frustrates users and increases CLS scores.
- Set explicit dimensions on images and videos. Add
widthandheightattributes to<img>and<video>tags so the browser reserves space before the resource loads. - Avoid dynamically injected content. Do not inject banners, ads, or cookie notices above existing content without reserving space.
- Use
font-display: swapfor web fonts to prevent invisible text during font loading.
Measure and Iterate
Page speed optimization is ongoing, not one-time. Measure after every change and track improvements over time.
- Run the free pagespeed checker on your top 10 pages and note the LCP, INP, and CLS scores.
- Use the bulk Core Web Vitals checker to test multiple URLs at once and identify the worst-performing pages.
- Fix the highest-impact issues first: image compression and lazy loading typically deliver the biggest gains.
- Re-test after each fix to confirm the score improved.
- Monitor Google Search Console for Core Web Vitals changes in the field data.
A fast site is a competitive advantage. Every millisecond you shave off load time improves rankings, conversions, and user satisfaction. Start with the pagespeed checker, pick the biggest bottleneck, and fix it today.