Skip to content
Back to Blog
Performance10 min read

Improve Core Web Vitals: 5 Fixes That Actually Work

Five concrete optimizations—image compression, lazy loading, CDN delivery, font preloading, and code splitting—that measurably improve LCP, CLS, and INP scores.

Written by Abdul AbrorTechnical Hosting Support Engineer
Improve Core Web Vitals: 5 Fixes That Actually Work
On this page

Google's Core Web Vitals measure what users actually feel when they land on your site. Slow paint, layout jumps, sluggish interactions—these turn visitors away before they even read a line. I've seen perfectly good content buried under red scores in Search Console because the site delivered uncompressed images over a congested origin server.

Core Web Vitals break down into three signals: Largest Contentful Paint (LCP) tracks how fast the biggest visible element loads, Cumulative Layout Shift (CLS) measures unexpected layout jumps, and Interaction to Next Paint (INP) captures how quickly the page responds to clicks and taps. Fix these three and you fix the user experience.

The five techniques below work across hosting stacks—shared cPanel accounts, VPS servers, managed WordPress hosts. Each addresses a specific bottleneck. Start with the one that matches your worst score.

1. Compress and resize images before upload

Oversized images kill LCP faster than anything else. A 4 MB JPEG from a camera phone might display at 800 pixels wide on the page, but the browser still downloads all 4 MB. That eats bandwidth, delays paint, and tanks your LCP score.

Resize images to their display dimensions before you upload them. If the hero image renders at 1200 pixels wide, export it at 1200 or 2400 (for Retina). Don't rely on CSS to scale a 4000-pixel original down to size.

After resizing, compress. JPEG quality of 80–85 is visually lossless for web use. WebP offers better compression than JPEG at the same quality and has near-universal browser support now. Use a tool like cwebp to convert:

cwebp -q 85 input.jpg -o output.webp

For batch conversion on a server:

for img in *.jpg; do cwebp -q 85 "$img" -o "${img%.jpg}.webp"; done

WordPress users should install a plugin that generates WebP variants on upload and serves them via the <picture> element with a JPEG fallback. ShortPixel and Imagify both handle this automatically.

Serve responsive images using srcset so mobile users download smaller files:

<img src="hero-1200.webp"
     srcset="hero-600.webp 600w, hero-1200.webp 1200w, hero-2400.webp 2400w"
     sizes="(max-width: 768px) 100vw, 1200px"
     alt="Hero image" />

This alone can cut LCP by half on image-heavy pages.

2. Lazy-load offscreen images and iframes

Browsers waste time downloading images that sit below the fold when the user might never scroll that far. Lazy loading defers those requests until the element approaches the viewport.

Native lazy loading is a single attribute:

<img src="photo.jpg" loading="lazy" alt="Description" />

Add loading="lazy" to every image except the LCP candidate (usually the hero). Lazy-loading the LCP image delays its load and worsens your score, so keep loading="eager" or omit the attribute entirely for above-the-fold content.

Iframes embed maps, videos, and widgets that often load heavy JavaScript. Lazy-load them too:

<iframe src="https://www.youtube.com/embed/VIDEO_ID" loading="lazy"></iframe>

WordPress has lazy loading enabled by default for images since version 5.5. Check your theme doesn't override it. If you need more control—threshold distances, placeholder animations—a JavaScript library like lazysizes gives you fine-grained options, but native lazy loading is fast and requires zero dependencies.

3. Deliver static assets through a CDN

A content delivery network caches your CSS, JavaScript, images, and fonts on edge servers close to your visitors. Instead of every request traveling back to your origin server in a single data center, the CDN serves files from the nearest POP.

This cuts latency—especially for international traffic—and reduces load on your origin. Round-trip time matters for LCP because every millisecond delay in fetching the hero image or critical CSS shows up in the paint metric.

Cloudflare's free tier caches static assets automatically once you point your DNS through their nameservers. Create a page rule to cache HTML if your content is mostly static:

  1. Go to Rules → Page Rules in the Cloudflare dashboard.
  2. Add a rule for example.com/*.
  3. Set Cache Level to Cache Everything.
  4. Set Edge Cache TTL to your preferred duration.

For dynamic sites (WordPress, logged-in users), skip HTML caching or use Cloudflare's APO product, which caches HTML smartly and purges on content updates.

Other CDNs work similarly. BunnyCDN, StackPath, and KeyCDN all offer pull zones that automatically cache your assets. Point the CDN at your origin, rewrite asset URLs in your HTML to the CDN domain, and traffic flows through the edge.

If you're on shared hosting, check whether your provider includes a CDN. Many cPanel hosts bundle Cloudflare integration or offer built-in CDN services that require zero configuration.

4. Preload critical fonts to eliminate render delay

Custom web fonts introduce a flash of invisible text (FOIT) or a flash of unstyled text (FOUT) while the browser downloads the font file. Both hurt CLS because text reflows after the font loads, and they delay LCP if the hero text uses the custom font.

Preloading fonts tells the browser to fetch them immediately, in parallel with other critical resources:

<link rel="preload" href="/fonts/roboto-regular.woff2" as="font" type="font/woff2" crossorigin>

Place the <link> in the <head>, before your CSS. The crossorigin attribute is required even for same-origin fonts because the font fetch uses CORS mode.

Only preload fonts used above the fold. Preloading every font variant wastes bandwidth and delays more important resources. Inspect your page in DevTools, check which fonts render in the viewport, and preload just those—usually one or two weights.

Use WOFF2 format exclusively. It compresses better than WOFF or TTF, and every modern browser supports it. Drop older formats unless you need IE11 support.

Pair preloading with font-display: swap in your CSS:

@font-face {
  font-family: 'Roboto';
  src: url('/fonts/roboto-regular.woff2') format('woff2');
  font-display: swap;
}

swap shows fallback text immediately, then swaps in the web font when it loads. This eliminates invisible text and reduces CLS because the fallback font renders without waiting.

5. Split JavaScript bundles to reduce main-thread blocking

Large JavaScript bundles block the main thread while they parse and execute. During that time the browser can't respond to clicks or taps, which tanks your INP score. Users experience the page as frozen.

Code splitting breaks one large bundle into smaller chunks that load on demand. The initial bundle contains only code needed for the current page; other modules load when the user navigates or interacts.

If you use a bundler like Webpack, Rollup, or Vite, enable dynamic imports:

// Instead of static import
import { heavyFunction } from './heavy-module.js';

// Use dynamic import
const module = await import('./heavy-module.js');
module.heavyFunction();

The bundler automatically splits heavy-module.js into a separate chunk. The browser fetches it only when that code path executes.

For WordPress, use a plugin like WP Rocket or Autoptimize to defer non-critical JavaScript. Deferring moves script execution until after the page renders, which improves INP by freeing up the main thread.

Defer scripts manually by adding the defer attribute:

<script src="analytics.js" defer></script>

Deferred scripts download in parallel but execute in order after HTML parsing finishes. This keeps them from blocking LCP.

Avoid inline scripts in the <head> unless they're tiny and critical. Inline scripts execute immediately and block parsing. Move them to external files and defer them, or place them at the end of <body>.

Minify your JavaScript in production. Tools like Terser strip whitespace and shorten variable names, reducing file size by 30–50%. Most bundlers minify automatically in production mode.

What else slows down Core Web Vitals?

These five fixes handle the most common bottlenecks, but other factors affect scores too. Third-party scripts (ads, analytics, chat widgets) often inject render-blocking resources or cause layout shifts. Audit them in Coverage and Network tabs in DevTools. Remove any that aren't essential.

Server response time feeds into LCP. If your Time to First Byte (TTFB) exceeds 600 ms, the page can't start painting quickly no matter how optimized the front end is. Use object caching (Redis or Memcached) if you run a dynamic site, enable OPcache for PHP, and consider upgrading to a host with faster disk I/O.

Unoptimized CSS delivery blocks rendering. Inline critical CSS (the styles needed for above-the-fold content) directly in the <head> and defer the rest. Tools like Critical or Critters automate this.

How do I test Core Web Vitals after making changes?

Use PageSpeed Insights to get lab scores immediately. Enter your URL and wait for the report. Lab data reflects a single test run under controlled conditions—useful for quick feedback.

For real-world scores, check the Core Web Vitals report in Google Search Console. This shows field data collected from actual Chrome users over 28 days. Changes you make today won't appear there for weeks, so use lab data to validate fixes early.

Lighthouse in Chrome DevTools gives you the same lab scores as PageSpeed Insights plus detailed diagnostics. Run it in Incognito mode to avoid interference from extensions.

Which Core Web Vital should I fix first?

Start with your worst score. If LCP is red (over 4 seconds), tackle images and server response time. If CLS is high (above 0.25), hunt down layout shifts caused by ads, embeds, or images without dimensions. If INP is poor (over 500 ms), defer and split JavaScript.

Fix one metric, test, then move to the next. Batching changes makes it harder to isolate what worked.

Do Core Web Vitals affect search rankings?

Yes, but not as much as relevance and content quality. Google confirmed Core Web Vitals as a ranking signal, but a slow page with strong content can still outrank a fast page with weak content. That said, two equally relevant pages will favor the faster one, and users prefer fast sites regardless of rankings.

Can I improve Core Web Vitals on shared hosting?

You can. Image optimization, lazy loading, and font preloading are client-side techniques that work anywhere. CDN delivery works on any host. The main constraint on shared hosting is server response time; if TTFB is high because you're on an overloaded shared server, caching and a CDN help but an upgrade to VPS or managed hosting might be necessary for consistently fast scores.

Where to measure your progress

Core Web Vitals optimization is continuous. Scores fluctuate as you add content, install plugins, or change themes. Monitor them monthly in Search Console and run lab tests before and after major changes.

These five fixes—compress images, lazy-load offscreen content, route traffic through a CDN, preload critical fonts, and split JavaScript—address the root causes of slow LCP, high CLS, and poor INP. Implement them in order of impact on your specific scores. Test after each change. Most sites see green scores across all three metrics after applying three or four of these techniques.

Your hosting environment matters, but technique matters more. I've seen shared-hosting WordPress sites hit green Core Web Vitals with nothing but image optimization and a free Cloudflare account. Start there.