DEV Community

Kush Bhandari
Kush Bhandari

Posted on

Web Core Vitals: Why Performance Decides SEO Ranking

Have you ever wondered why two websites with similar content rank differently on Google?
Or why you built a great web application, but users still struggle to find it?

The answer often lies in Web Core Vitals.

Google doesn’t rank pages only by content anymore. It also evaluates real user experience. If two sites have similar content, the one with better Web Core Vitals usually ranks higher.

What Are Web Core Vitals?

Web Core Vitals are Google-defined metrics that measure real user experience on a website. They focus on three key aspects:

  • LCP – Largest Contentful Paint (Loading experience)
  • INP – Interaction to Next Paint (Responsiveness)
  • CLS – Cumulative Layout Shift (Visual stability)

Let’s understand each one, how it affects SEO, and how to optimize it.

1) LCP (Largest Contentful Paint)

Definition:
LCP measures the time taken for the largest visible content element in the viewport to appear.

This element is usually:

  • A hero image
  • A banner
  • A large heading
  • A product image

Example

Think about the Amazon home page.
The big banner image or main product section that appears first is usually the LCP element.

LCP Score Thresholds

  • ≤ 2.5s → Good
  • 2.5s – 4s → Needs improvement
  • > 4s → Poor

What Impacts LCP?
1. Images (Biggest Factor)

Large or unoptimized images delay LCP.

  • Best practices:
  • Use modern formats like WebP / AVIF
  • Do not lazy-load above-the-fold images
  • Preload hero images
  • Next.js example:
  • Next.js automatically:
  • Optimizes images
  • Converts to WebP/AVIF
  • Preloads priority images

2. Hero Images via CSS (Hidden LCP killer)

  • Background images in CSS are discovered late by the browser.
  • Bad: .hero { background-image: url("/hero.jpg"); }
  • Better: Use or instead so the browser can preload it.

3. TTFB (Time To First Byte)

If the server responds slowly, the browser cannot render anything early.

Fixes:

  • CDN
  • Caching
  • Server-side rendering (SSR)
  • Edge deployment
  • Why Next.js helps:
  • Server-rendered pages return HTML faster, improving LCP.

2) INP (Interaction to Next Paint)

Definition:
INP measures how quickly the UI responds after a user interaction (click, keypress, tap).

Example interactions:

  • Typing in a search box
  • Clicking a button
  • Selecting a dropdown
  • INP Score Thresholds ≤ 200ms → Good 200–500ms → Needs improvement > 500ms → Poor
  • Example
  • User types in a search input:
  • UI freezes for 600ms
  • Results appear late → Poor INP
  • Common Causes of Poor INP
  • Heavy JavaScript on the main thread
  • Large re-renders on every keystroke
  • Expensive calculations in event handlers
  • Too much client-side JavaScript

How to Improve INP
1. Avoid Blocking the Main Thread

Move heavy logic out of event handlers.

Bad:

onChange={() => filterBigList()}

Better:

  • Debounce input
  • Defer work
  • Use useTransition

2. Reduce Re-renders

  • Split state
  • Use memo, useCallback
  • Avoid global state updates on typing

3. Prefer Server Components (Next.js)

Server Components:

Reduce client JS

Reduce hydration cost

Improve responsiveness

3) CLS (Cumulative Layout Shift)

Definition:
CLS measures unexpected layout movement during page load.

Example

  • You try to click a button, but:
  • An image loads above it
  • The page shifts
  • You click the wrong thing
  • That’s CLS.
  • CLS Threshold
  • ≤ 0.1 → Good

How to Prevent CLS
1. Fonts

Fonts loading late cause text to resize.

Next.js solution:

import { Inter } from "next/font/google";

Fonts are:

Self-hosted

Loaded at build time

Metric-matched
→ Almost zero CLS

2. Images

Always define dimensions.

Next.js enforces this automatically.

3. Ads

Ads loading late cause major layout shifts.

Fix:

.ad-slot {
min-height: 250px;
}

Always reserve space before the ad loads.

4. Skeletons & Placeholders

Instead of loading content suddenly:

{loading ? : }

This keeps layout stable.

5. Server Components

Server-rendered content appears immediately, reducing layout surprises.

Why Web Core Vitals Matter for SEO

  • Google uses Web Core Vitals as ranking signals, based on real user data.
  • Better Web Core Vitals mean:
  • Better user experience
  • Lower bounce rate
  • Higher SEO ranking

Top comments (0)