Skip to main content
1:1 mock interviews with Sumit, scored on a real hiring rubric.Book a slot →

Core Web Vitals Interview Questions: LCP, INP, CLS and How to Improve Them

12 Core Web Vitals interview questions with fixes: what LCP, INP and CLS measure, their thresholds, field vs lab data, the 75th percentile, improving LCP, long tasks and INP, causes of layout shift, TTFB and FCP, measuring with web-vitals, and SEO impact.

Sumit KumarUpdated Oct 12, 20267 min readWeb Performance
Core Web Vitals Interview Questions: LCP, INP, CLS and How to Improve Them

Core Web Vitals are Google's user-centred metrics for loading speed, responsiveness and visual stability. They affect search ranking and, more importantly, how users experience your site, so performance interviews almost always ask about them. Here are 12 Core Web Vitals interview questions with answers and concrete fixes.

Core Web Vitals and their good thresholds: Largest Contentful Paint at or under 2.5 seconds for loading, Interaction to Next Paint at or under 200 milliseconds for responsiveness, and Cumulative Layout Shift at or under 0.1 for visual stability

The metrics#

Q1. What are the Core Web Vitals and their thresholds?#

MetricMeasuresGoodNeeds improvementPoor
LCP (Largest Contentful Paint)Loading: when the main content appears≤ 2.5 s≤ 4 s> 4 s
INP (Interaction to Next Paint)Responsiveness to user input≤ 200 ms≤ 500 ms> 500 ms
CLS (Cumulative Layout Shift)Visual stability≤ 0.1≤ 0.25> 0.25

INP replaced FID (First Input Delay) as a Core Web Vital in March 2024. FID measured only the input delay of the first interaction; INP considers the full latency of interactions throughout the visit.

Q2. Why is each metric judged at the 75th percentile?#

Answer: a page "passes" if at least 75% of real page visits meet the "good" threshold for each metric, measured separately for mobile and desktop. The 75th percentile reflects most users' experience while being less sensitive to extreme outliers than the maximum. It means optimising only for your fast office laptop isn't enough: slow phones and networks count.

Q3. What is the difference between field data and lab data?#

Field data (RUM)Lab data
SourceReal users' browsersA simulated test run
ToolsChrome UX Report (CrUX), Search Console, PageSpeed Insights field section, web-vitals libraryLighthouse, PageSpeed Insights lab section, WebPageTest, DevTools
StrengthShows the true experience across devices and networksReproducible; great for debugging and CI
LimitationDelayed (CrUX is a 28-day window); harder to debugOne device and network profile; can't measure real INP

Ranking uses field data. Lighthouse reports Total Blocking Time (TBT) as a lab proxy for responsiveness, because lab tests have no real user interactions.

Largest Contentful Paint#

Q4. What counts as the LCP element, and what slows it down?#

Answer: LCP is the render time of the largest image, video poster, background image or text block visible in the viewport. It's usually a hero image or a headline. LCP time breaks into four parts, and each suggests a fix:

  1. Time to First Byte (TTFB): slow server, no CDN, redirects.
  2. Resource load delay: the LCP image is discovered late (lazy-loaded, set in CSS or injected by JavaScript).
  3. Resource load time: the image file is too large.
  4. Element render delay: render-blocking CSS or JS, or client-side rendering that waits for JavaScript.

Q5. How do you improve LCP?#

HTML
<!-- Make the hero image discoverable and high priority -->
<img
  src="/hero-1200.avif"
  srcset="/hero-600.avif 600w, /hero-1200.avif 1200w"
  sizes="100vw"
  width="1200" height="600"
  alt="Fresh vegetables on a market stall"
  fetchpriority="high" />   <!-- no loading="lazy" above the fold! -->

<link rel="preconnect" href="https://images.example-cdn.com" crossorigin>
  • Serve HTML fast: CDN, caching, server-side rendering or static generation, fewer redirects.
  • Put the LCP image in the HTML (not CSS or JS) with fetchpriority="high"; never lazy-load it.
  • Compress images, use AVIF/WebP and responsive srcset.
  • Remove render-blocking resources: inline critical CSS, defer scripts.
  • For text LCP: preload the font and use font-display: swap or optional.

Interaction to Next Paint#

Q6. What does INP measure exactly?#

Answer: for each click, tap or key press, INP measures the time from the input until the browser paints the next frame showing a response. It has three phases:

  • Input delay: the main thread is busy with other work when the user interacts.
  • Processing time: your event handlers run.
  • Presentation delay: style, layout and paint of the update.

The reported INP is roughly the slowest interaction during the visit (ignoring a few outliers on pages with many interactions). Scrolling and hovering aren't counted.

Q7. What are long tasks, and how do you fix a poor INP?#

JavaScript
// Before: one long task blocks the main thread for ~400ms
button.addEventListener("click", () => {
  updateButtonState();          // visible feedback
  recalculateEverything();      // heavy work
  sendAnalytics();
});

// After: give visual feedback first, then yield before heavy work
button.addEventListener("click", async () => {
  updateButtonState();
  await yieldToMain();          // lets the browser paint now
  recalculateEverything();
  requestIdleCallback(sendAnalytics);
});

function yieldToMain() {
  if ("scheduler" in window && "yield" in scheduler) return scheduler.yield();
  return new Promise((resolve) => setTimeout(resolve, 0));
}

Answer: a long task is any main-thread task over 50ms; while it runs, the page can't respond. Fixes:

  • Break up long tasks and yield to the main thread (scheduler.yield(), setTimeout).
  • Do less work: debounce input handlers, avoid unnecessary re-renders (see React performance questions), use useTransition.
  • Move heavy computation to a Web Worker.
  • Reduce and defer JavaScript, especially third-party scripts.
  • Keep the DOM small and avoid layout thrashing (see critical rendering path questions).

Cumulative Layout Shift#

Q8. What causes layout shifts?#

  • Images, videos and iframes without width and height.
  • Ads, embeds and banners inserted without reserved space.
  • Content injected above existing content (cookie bars, "new posts" banners).
  • Web fonts swapping in with different metrics (FOUT).
  • Animations of layout properties like top or height instead of transform.

CLS is calculated as impact fraction × distance fraction for each unexpected shift, grouped into session windows; the worst window is reported. Shifts within 500ms of a user interaction (like expanding an accordion) don't count.

Q9. How do you fix CLS?#

CSS
/* Reserve space for media */
img, video { height: auto; max-width: 100%; }  /* with width/height attributes in HTML */
.video-embed { aspect-ratio: 16 / 9; width: 100%; }

/* Reserve space for an ad slot */
.ad-slot { min-height: 250px; }

/* Reduce font swap shift */
@font-face {
  font-family: "Inter";
  src: url("/fonts/inter.woff2") format("woff2");
  font-display: optional;
  size-adjust: 107%;        /* match fallback metrics */
}

/* Animate with transform, not layout properties */
.toast { transform: translateY(100%); transition: transform 200ms; }
.toast.show { transform: translateY(0); }

Also: show skeleton placeholders that match the final size, put dynamic banners in overlays or below the fold, and make pages eligible for the back/forward cache so returning visits restore instantly without shifts.

Measurement and impact#

Q10. What are TTFB and FCP, and how do they relate to the Core Web Vitals?#

Answer: they're supporting diagnostic metrics, not Core Web Vitals themselves:

  • TTFB (Time to First Byte): time until the first byte of the HTML response arrives. Good is roughly 0.8s or less. A slow TTFB delays everything, especially LCP.
  • FCP (First Contentful Paint): when any text or image first renders. Good is 1.8s or less.
  • TBT (Total Blocking Time): lab metric summing the blocking part of long tasks; correlates with INP.

Q11. How do you measure Core Web Vitals from real users?#

JavaScript
import { onLCP, onINP, onCLS } from "web-vitals/attribution";

function sendToAnalytics(metric) {
  const body = JSON.stringify({
    name: metric.name,          // "LCP" | "INP" | "CLS"
    value: metric.value,
    rating: metric.rating,      // "good" | "needs-improvement" | "poor"
    page: location.pathname,
    debug: metric.attribution,  // e.g. LCP element, slow interaction target
  });
  navigator.sendBeacon("/analytics/vitals", body);
}

onLCP(sendToAnalytics);
onINP(sendToAnalytics);
onCLS(sendToAnalytics);

Answer: Google's web-vitals library wraps the browser's Performance APIs (PerformanceObserver for largest-contentful-paint, event and layout-shift entries). The attribution build tells you which element or interaction caused a poor score. Send results with navigator.sendBeacon so they survive page unload, then segment by page type, device and country.

Q12. Do Core Web Vitals affect SEO? How would you prioritise fixes?#

Answer: Core Web Vitals are part of Google's page experience signals. They act more like a tie-breaker than a dominant factor: relevant, high-quality content still matters most. The bigger business case is user experience: faster, stable pages typically improve conversion and reduce bounce rates.

To prioritise:

  1. Check Search Console's Core Web Vitals report and CrUX to find failing page groups (templates), not single URLs.
  2. Start with the template that gets the most traffic and the metric that fails worst.
  3. Reproduce in the lab, apply targeted fixes, and verify in field data over the following weeks.
  4. Set a performance budget and Lighthouse CI checks to prevent regressions.

Quick revision#

MetricGoodTop fixes
LCP≤ 2.5 sFast TTFB, fetchpriority="high" hero image, no lazy-load above the fold, remove render-blocking CSS/JS
INP≤ 200 msBreak up long tasks, yield, less JavaScript, Web Workers, fewer re-renders
CLS≤ 0.1Width/height on media, reserve space for ads and embeds, font metric matching, animate transforms

Related: HTTP caching and service worker questions and responsive design questions.

Key takeaways#

  • The Core Web Vitals are LCP (loading), INP (responsiveness) and CLS (visual stability), judged at the 75th percentile of real visits.
  • Field data decides rankings; lab tools like Lighthouse are for debugging.
  • Fix LCP by speeding up the server and prioritising the hero image.
  • Fix INP by breaking up long tasks and shipping less main-thread JavaScript.
  • Fix CLS by reserving space for media, ads and fonts, and measure everything with the web-vitals library.