Skip to content
Back to Blog
Performance11 min read

How to Optimize Core Web Vitals in 2026: LCP, CLS & INP

A practical checklist for optimizing Largest Contentful Paint, Cumulative Layout Shift, and Interaction to Next Paint through hosting configuration, CDN strategies, and server-level improvements.

Written by Abdul AbrorTechnical Hosting Support Engineer
How to Optimize Core Web Vitals in 2026: LCP, CLS & INP
On this page

Core Web Vitals remain a critical ranking factor and user experience metric in 2026. Google's focus on Largest Contentful Paint (LCP), Cumulative Layout Shift (CLS), and Interaction to Next Paint (INP) means your hosting infrastructure, CDN configuration, and server-side optimizations directly affect both search visibility and conversion rates. This guide provides a checklist approach to optimizing each metric from a hosting and infrastructure perspective.

Understanding the Three Core Web Vitals

Before diving into optimization, understand what each metric measures:

Largest Contentful Paint (LCP) measures loading performance. It marks the time when the largest visible content element renders in the viewport. Good LCP is under 2.5 seconds.

Cumulative Layout Shift (CLS) measures visual stability. It quantifies unexpected layout shifts during page load. Good CLS is under 0.1.

Interaction to Next Paint (INP) replaced First Input Delay in 2024 and measures responsiveness. It assesses the latency of all user interactions throughout the page lifecycle. Good INP is under 200 milliseconds.

From a hosting perspective, server response time, resource delivery, and computation efficiency drive these metrics.

Optimizing Largest Contentful Paint (LCP)

LCP typically involves your hero image, heading block, or main content area. Server and CDN configuration play the largest role in optimization.

Server Response Time (TTFB)

Time to First Byte is the foundation of LCP. A slow server response delays everything downstream.

Action checklist:

  • Enable opcode caching on PHP servers (OPcache, APCu). Verify in php.ini:
opcache.enable=1
opcache.memory_consumption=256
opcache.max_accelerated_files=10000
opcache.revalidate_freq=60
  • Use PHP-FPM with appropriate worker configuration instead of mod_php. Match pm.max_children to your available memory and expected concurrent traffic.

  • Implement Redis or Memcached for database query and object caching, especially on WordPress and dynamic CMSs.

  • Tune MySQL/MariaDB for your workload. Enable the query cache if on older versions; use InnoDB buffer pool efficiently:

innodb_buffer_pool_size = 1G
innodb_log_file_size = 256M
max_connections = 150
  • Choose geographically appropriate hosting. If your audience is regional, host in that region rather than relying solely on CDN edge caching.

CDN and Static Asset Delivery

CDN edge caching reduces round-trip time for static resources that typically form the LCP element.

Action checklist:

  • Configure aggressive cache headers for immutable assets:
<IfModule mod_expires.c>
  ExpiresActive On
  ExpiresByType image/jpg "access plus 1 year"
  ExpiresByType image/jpeg "access plus 1 year"
  ExpiresByType image/webp "access plus 1 year"
  ExpiresByType image/png "access plus 1 year"
  ExpiresByType text/css "access plus 1 year"
  ExpiresByType application/javascript "access plus 1 year"
</IfModule>
  • Use Cloudflare APO (Automatic Platform Optimization) or similar full-page caching for WordPress and other CMSs. This caches HTML at the edge, not just assets.

  • Enable HTTP/3 and QUIC on your CDN and origin server. HTTP/3 reduces connection overhead and improves performance over unreliable networks.

  • Implement Early Hints (HTTP 103) to preload critical resources before the main HTML response completes. Cloudflare and other CDNs support this.

Image Optimization

If your LCP element is an image, optimization is non-negotiable.

Action checklist:

  • Serve images in modern formats (WebP, AVIF) with fallbacks. Use <picture> elements or CDN automatic format conversion.

  • Use responsive images with srcset to avoid sending desktop-sized images to mobile devices.

  • Compress images without visible quality loss. Aim for a quality setting between 75-85 for JPEGs.

  • Set explicit width and height attributes on all images to prevent layout shifts (also helps CLS).

  • Preload the LCP image in the HTML head:

<link rel="preload" as="image" href="/hero.webp" fetchpriority="high">
  • Avoid lazy-loading the LCP image. Lazy-loading above-the-fold content delays LCP.

Resource Prioritization

Browser resource hints guide how the browser loads critical assets.

Action checklist:

  • Preconnect to required origins early:
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://cdn.yoursite.com" crossorigin>
  • Use fetchpriority="high" on your LCP image or critical resource to signal importance to the browser.

  • Defer non-critical JavaScript with defer or async attributes, or move scripts to the end of the body.

  • Minimize render-blocking CSS. Inline critical CSS for above-the-fold content and defer the rest.

Optimizing Cumulative Layout Shift (CLS)

CLS measures visual stability. Unexpected shifts frustrate users and harm scores. Most shifts come from images, ads, embeds, or dynamically injected content loading without reserved space.

Reserve Space for Dynamic Content

Prevent layout shifts by allocating space before content loads.

Action checklist:

  • Set explicit width and height on images and video elements. Browsers calculate aspect ratio and reserve space before the resource loads:
<img src="hero.jpg" width="1200" height="630" alt="Hero image">
  • Use aspect-ratio CSS for responsive elements:
.video-container {
  aspect-ratio: 16 / 9;
  width: 100%;
}
  • Reserve space for ads and embeds with min-height or placeholder dimensions. If an ad fails to load, the space remains, preventing shift.

  • Avoid inserting content above existing content after page load, unless in response to user interaction.

Font Loading Strategy

Web fonts cause layout shift when fallback fonts display first, then swap to the web font.

Action checklist:

  • Use font-display: optional or font-display: swap in your @font-face declarations:
@font-face {
  font-family: 'CustomFont';
  src: url('/fonts/custom.woff2') format('woff2');
  font-display: optional;
}
  • Preload critical fonts in the HTML head:
<link rel="preload" as="font" href="/fonts/custom.woff2" type="font/woff2" crossorigin>
  • Choose fallback fonts that closely match your web font metrics to minimize shift when swapping.

  • Self-host fonts rather than loading from third-party CDNs to reduce connection overhead and enable better caching.

Server-Side Rendering Considerations

Dynamic content rendered on the server prevents client-side layout shifts.

Action checklist:

  • Render skeleton screens or placeholders on the server for content that loads asynchronously.

  • Use SSR (Server-Side Rendering) or SSG (Static Site Generation) for frameworks like Next.js, Nuxt, or Gatsby. Pre-rendered HTML eliminates most client-side shift sources.

  • Avoid hiding content with CSS that's revealed by JavaScript. If content is hidden server-side and shown client-side, ensure space is reserved.

Optimizing Interaction to Next Paint (INP)

INP measures responsiveness across all page interactions, not just the first. It captures click, tap, and keyboard event latency. Long JavaScript tasks and blocking main-thread work harm INP.

Reduce JavaScript Execution Time

Heavy JavaScript blocks the main thread and delays visual feedback.

Action checklist:

  • Split long tasks into smaller chunks using setTimeout, requestIdleCallback, or modern scheduler APIs.

  • Defer or lazy-load non-critical scripts. Only load what's needed for initial viewport interaction.

  • Remove unused JavaScript. Audit third-party scripts (analytics, chat widgets, social embeds) and remove or defer those not critical to user experience.

  • Minify and compress JavaScript. Enable gzip or Brotli compression at the server or CDN level:

<IfModule mod_deflate.c>
  AddOutputFilterByType DEFLATE text/html text/plain text/css application/javascript
</IfModule>
  • Use code-splitting in modern frameworks to load only necessary bundles per route.

Server Response Time for API Calls

Client-side interactions often trigger API requests. Slow API responses delay the next paint.

Action checklist:

  • Optimize database queries triggered by AJAX calls. Add indexes, reduce N+1 query patterns, and cache results.

  • Use HTTP/2 or HTTP/3 to multiplex requests and reduce connection overhead.

  • Implement server-side caching for API endpoints that return static or infrequently changing data.

  • Set up edge caching for API responses where appropriate using CDN cache rules.

Input Responsiveness

Provide immediate visual feedback for user actions.

Action checklist:

  • Add CSS-based hover and active states before JavaScript logic executes. This gives instant feedback even if JS is delayed.

  • Debounce or throttle event handlers for high-frequency events like scroll or input.

  • Avoid layout thrashing. Batch DOM reads and writes instead of interleaving them:

// Bad: read-write-read-write
const height = element.offsetHeight;
element.style.height = height + 10 + 'px';
const width = element.offsetWidth;
element.style.width = width + 10 + 'px';

// Good: read-read-write-write
const height = element.offsetHeight;
const width = element.offsetWidth;
element.style.height = height + 10 + 'px';
element.style.width = width + 10 + 'px';
  • Use web workers for heavy computation to keep the main thread responsive.

Hosting and Server Configuration for All Metrics

Beyond metric-specific optimizations, general hosting practices improve all Core Web Vitals.

Enable HTTP/2 or HTTP/3

Modern HTTP protocols reduce latency through multiplexing and header compression.

For Apache:

Protocols h2 h2c http/1.1

For Nginx:

listen 443 ssl http2;
listen 443 quic reuseport;
http3 on;

Implement Brotli Compression

Brotli offers better compression than gzip for text-based resources.

For Nginx:

brotli on;
brotli_types text/plain text/css application/javascript application/json image/svg+xml;

Verify your host or CDN enables Brotli. Cloudflare enables it by default.

Use a CDN with Smart Routing

CDNs like Cloudflare, Fastly, and BunnyCDN use Anycast routing and smart traffic management to reduce latency.

Action checklist:

  • Enable Argo Smart Routing or equivalent for dynamic content delivery optimization.

  • Use Tiered Caching to reduce origin requests by caching at regional data centers before edge locations.

  • Configure proper cache-control headers on your origin to maximize CDN effectiveness.

Monitor and Test Regularly

Optimization is iterative. Use real-user monitoring (RUM) and synthetic testing.

Action checklist:

  • Use Google Search Console's Core Web Vitals report to track field data from real users.

  • Run PageSpeed Insights and Lighthouse regularly to catch regressions.

  • Set up Cloudflare Web Analytics or similar RUM to monitor vitals across your user base.

  • Test on real devices and throttled connections to simulate your users' experience.

WordPress-Specific Optimizations

WordPress sites require additional attention due to plugin overhead and dynamic content.

Action checklist:

  • Use a performance plugin like WP Rocket, LiteSpeed Cache, or W3 Total Cache for page caching, minification, and lazy-loading.

  • Limit active plugins to essential functionality. Audit and remove unused plugins regularly.

  • Use a quality managed WordPress host with object caching and server-level optimizations built in.

  • Disable unnecessary WordPress features like embeds, emojis, and REST API endpoints if not needed:

// In functions.php or a custom plugin
remove_action('wp_head', 'wp_oembed_add_discovery_links');
remove_action('wp_head', 'print_emoji_detection_script', 7);
remove_action('wp_print_styles', 'print_emoji_styles');
  • Choose a lightweight theme optimized for Core Web Vitals. Avoid bloated page builders when possible.

Conclusion

Optimizing Core Web Vitals in 2026 requires a layered approach spanning hosting infrastructure, CDN configuration, and front-end development. Start with server response time and caching to improve LCP. Reserve space for dynamic content and optimize font loading for CLS. Reduce JavaScript execution and provide immediate feedback for INP. Each metric improvement compounds into better user experience and search rankings. Use the checklists above as a systematic audit of your current setup, prioritize the highest-impact changes for your specific site, and monitor continuously. Core Web Vitals optimization is not a one-time fix but an ongoing practice aligned with hosting best practices and modern web performance standards.

FAQ

What is a good score for Core Web Vitals in 2026?

Good scores remain: LCP under 2.5 seconds, CLS under 0.1, and INP under 200 milliseconds. These thresholds should be met for at least 75% of page visits.

Does hosting location affect Core Web Vitals?

Yes. Server response time (TTFB) directly impacts LCP. Hosting closer to your primary audience reduces latency. Combine regional hosting with a global CDN for best results.

Can I optimize Core Web Vitals on shared hosting?

You can improve scores on shared hosting through CDN usage, caching, image optimization, and front-end techniques. However, resource contention on shared servers may limit TTFB and INP improvements. VPS or managed hosting typically provides better control.

How often should I test Core Web Vitals?

Test after any significant code deployment, theme change, or plugin update. Set up continuous monitoring with RUM tools to catch regressions automatically. Review Search Console data monthly.

Does Cloudflare help with Core Web Vitals?

Yes. Cloudflare offers APO for full-page caching, HTTP/3 support, Brotli compression, image optimization through Polish or Cloudflare Images, Early Hints, and smart routing. Properly configured, it significantly improves all three metrics.