Improving performance can make a site easier to use. Google uses Core Web Vitals in its ranking systems, but better scores do not guarantee higher rankings or revenue. Conversion effects depend on the audience, task and other changes; measure them rather than assuming a fixed gain per 100 milliseconds. This guide covers network optimizations, server response, rendering, JavaScript, fonts, images and third-party scripts. Prioritize measured bottlenecks and verify results on representative devices.
Network Layer Optimizations
Before the browser can render anything, packets must travel from your server to the user and back. Network optimizations cut that round-trip time and the bytes that have to travel.
Enable HTTP/2 or HTTP/3
HTTP/3 uses QUIC and can reduce transport-level head-of-line blocking between streams. Benefits, 0-RTT availability and client/CDN support depend on configuration and network conditions. Compare measured performance; curl diagnostics require an HTTP/3-enabled build.
Use a CDN
A CDN can serve cacheable assets closer to users. Benefits depend on cache hit rate, geography, routing and origin performance; no fixed TTFB improvement follows. Compare current plans and configure cache rules carefully.
Compress responses
Consider Brotli or gzip for appropriate text responses and negotiate Content-Encoding correctly. Savings depend on content and settings; already compressed formats such as WOFF2 often gain little. Avoid compressing sensitive responses without considering relevant side-channel risks.
Resource hints
Consider preconnect for important cross-origin resources and preload only critical resources whose late discovery is a measured problem. Unneeded hints can consume connections or bandwidth. Check responsive-image selection, font crossorigin settings and the actual waterfall; avoid indiscriminate preloading.
Server Response Optimization
Server response time can constrain LCP, but navigation, redirects, caching and rendering all affect the timeline. Investigate slow responses with representative field and lab data; 600 ms is not a universal pass threshold.
Cache only where appropriate, with invalidation and privacy boundaries. Long-lived public caches suit versioned non-sensitive assets; do not publicly cache personalized or private responses.
Use suitable public cache lifetimes for versioned static assets. Query and page caches need explicit correctness, invalidation and access-control rules; edge caching is not automatically appropriate for a homepage or category page.
Database query optimization
Database queries can contribute to response time. Profile slow queries and N+1 access, then test indexing, caching or precomputation where appropriate. Preserve freshness, authorization and invalidation; aggressive caching is not universally safe or beneficial.
Right-size your hosting
Insufficient capacity can increase response time during load, but cost and platform category do not predict a fixed TTFB range. Measure representative traffic, region and cache behavior before changing hosting.
Rendering Path Optimization
Even with a fast server and CDN, render-blocking resources can stall the page. The browser must download, parse, and execute CSS and JavaScript before it can paint — minimize what blocks rendering.
Inline critical CSS
Minimize render-blocking work based on measurement. Selective critical CSS may help, but 14KB is not a universal first-packet limit. Deferred styles need a reliable loading strategy and testing for flashes, layout changes and no-JavaScript behavior.
Defer non-critical JavaScript
Add defer or async to any script not needed for first paint. defer waits until HTML parsing completes; async runs as soon as it downloads. Inline only what is absolutely required (typically nothing).
Remove unused CSS and JavaScript
Use DevTools Coverage across representative routes and interactions, not only initial load. Tree shaking depends on module structure, side-effect declarations and build configuration; it does not automatically remove all unused code. Compare alternatives against actual required features and bundle output.
Image Delivery
Images are typically the largest payload on a page and a leading LCP element. Aggressive image optimization is one of the highest-ROI performance investments.
Modern formats
Compare AVIF, WebP and JPEG output for the actual images and supported clients. No format guarantees the best compression or a fixed savings percentage. Use picture with suitable fallbacks when needed.
Responsive images
Use srcset and sizes to offer appropriate image candidates for layout width and device pixel density. Inspect the browser’s selection rather than equating viewport CSS pixels with required image pixels.
Lazy loading
Add loading="lazy" to images below the fold. Never lazy load the LCP image — that delays the critical paint. Lazy loading is now native in all major browsers.
fetchpriority hints
Consider fetchpriority="high" for a likely LCP image that needs earlier prioritization. It is a hint, not a scheduling guarantee; avoid marking many resources high and test the target browsers and network conditions.
CDN image transformation
Image services can provide resizing, format negotiation and compression, depending on the product and plan. Configure permitted transformations, caching, source access and cost controls. They do not universally support unlimited variants or eliminate every build-time step.
Font Optimization
Web-font loading can affect text visibility, LCP and layout stability. Inspect the actual font requests and fallback behavior; default settings do not inevitably cause wasted time or shifts.
Self-host fonts
Self-hosting can avoid a separate font origin and provide control over delivery and privacy. It is not automatically faster: licensing, cache behavior, formats, subsets and server configuration matter.
font-display: swap
Choose font-display for the experience. swap permits fallback text while a font loads but can cause layout shifts. Block periods and loading behavior vary; a missing swap declaration does not guarantee bad LCP.
Preload critical fonts
Preload only fonts whose late discovery is a measured critical-path problem. The useful number depends on the page, font subsets and resource competition; verify correct URLs, formats and crossorigin settings.
<link rel="preload" as="font" type="font/woff2"
href="/fonts/inter-regular.woff2" crossorigin>
Eliminate font swap shift
Matching fallback metrics with size-adjust and metric overrides can reduce font-swap layout shifts. Tools can help generate values, but test the actual fonts and scripts; zero shift is not guaranteed.
JavaScript Performance
JavaScript is the leading cause of poor INP and increasingly the dominant performance bottleneck on modern sites. Less JavaScript means a more responsive page.
Code-split aggressively
Ship only what each route needs. Modern frameworks (Next.js, Nuxt, Remix, SvelteKit) code-split routes by default. Audit with source-map-explorer or bundle-analyzer.
Break up long tasks
A main-thread task longer than 50 ms is a long task and may delay interaction handling or presentation. Break appropriate work into smaller units and yield where supported; requestAnimationFrame runs before paint and is not a safe place for long nonvisual work. A long task alone does not prove poor INP.
Move heavy work to Web Workers
Parsing large JSON, encryption, image manipulation, large data transformations — anything CPU-bound — belongs in a Web Worker. Comlink makes worker communication ergonomic.
Defer hydration
Modern frameworks support partial hydration (Astro Islands, Qwik resumability, React Server Components) — hydrating only the interactive parts of the page rather than the entire tree. The performance benefit is dramatic on content-heavy pages with isolated interactive widgets.
Third-Party Script Management
Third-party scripts — analytics, A/B testing, chat widgets, ad networks, tag managers — are often the largest INP contributor because you do not control their performance.
Audit relentlessly
List every third-party script. For each one, ask: what does this do, what is its performance cost (load time, main-thread blocking, bytes), is there a lighter alternative, can we defer it until after first interaction? Most sites can remove or defer half their tags without losing functionality.
Load patterns
- async for analytics and tracking scripts that do not affect visible content.
- defer for scripts that need the DOM but do not block rendering.
- Conditionally load chat widgets, A/B testing, and similar tools only after first user interaction.
- Partytown to relocate third-party scripts to a Web Worker so they cannot block the main thread.
Measurement & Monitoring
Performance regresses every release without continuous measurement. Build the monitoring once and check it weekly.
- Chrome DevTools Performance panel for debugging specific issues
- PageSpeed Insights for one-off URL audits with field+lab data
- Search Console Core Web Vitals report for field data trends by URL pattern
- web-vitals library for collecting real-user metrics from your own users
- Lighthouse CI in your build pipeline to catch regressions before deploy
- Document performance budgets appropriate to the product and require meaningful regressions to be measured and justified; an arbitrary 100 KB change is not a universal acceptance threshold.
The 80/20 of Page Speed
If you have limited time, prioritize:
- Check support and configuration for HTTP/2 or HTTP/3 and suitable text compression; setup differs by host and CDN. Verify actual responses rather than assuming each is a single toggle.
- Convert and optimize images (AVIF/WebP + responsive + lazy load)
- Consider image preload or fetchpriority only where discovery or priority is a measured LCP bottleneck; use correct responsive candidates and avoid competing preloads.
- Evaluate font hosting, font-display and preload against licensing, layout shifts, text visibility and measured resource competition. None is a universal default.
- Defer or async every non-critical script
- Remove unnecessary JavaScript and assess alternatives to heavy dependencies; measure actual savings rather than targeting a promised percentage.
- Cache aggressively at the CDN and origin
These are candidate improvements, not a guaranteed route from Poor to Good. Measure the site’s bottlenecks and validate field outcomes; some applications need architectural or component changes.
Compress Your Images for Faster LCP
Convert and compare supported image outputs. Balance visual quality and byte size; image compression helps where image transfer or decoding is a measured bottleneck, not automatically the highest-return change.
Image Compressor →