Frontend Interview Questions

Core Web Vitals: LCP, INP, CLS Optimization

What are Core Web Vitals? Pick one and explain how you'd improve it.

Why Interviewers Ask This

Performance-focused frontend roles ask this. Google uses these as ranking signals, so SEO-conscious teams care deeply.

How to Answer

  1. 1

    LCP (Largest Contentful Paint): time for the biggest visible element. Target <2.5s. Fix with CDN, image optimization (AVIF/WebP), server-side rendering, preconnect to origins.

  2. 2

    INP (Interaction to Next Paint): replaced FID in March 2024. Measures responsiveness to all interactions. Target <200ms. Fix with less JS on main thread (web workers, code splitting, deferred hydration).

  3. 3

    CLS (Cumulative Layout Shift): visual stability. Target <0.1. Fix by reserving space for images/ads (explicit width/height), avoid inserting content above existing content, use `aspect-ratio` CSS.

  4. 4

    Measurement: field data (RUM via `web-vitals` lib) + lab data (Lighthouse). Field is what Google uses for ranking.

  5. 5

    Common wins: lazy-load below-fold images (loading=lazy), preload LCP image, avoid synchronous 3rd-party scripts, budget your JS bundle.

Sample Answer

Three metrics: LCP (paint speed), INP (responsiveness), CLS (stability). On a recent project our LCP was 4.2s — the culprit was a hero image loaded after the hero component hydrated. I added a `<link rel="preload" as="image">` for the hero, converted it to AVIF, served it from the CDN with a responsive srcset, and LCP dropped to 1.8s. For INP I audit the main thread — most wins come from splitting big bundles, deferring non-critical hydration (React.lazy, islands architecture), and moving hashing/parsing to web workers. CLS is usually dumb: ads and images inserted without reserved height. `width/height` attributes or `aspect-ratio` CSS fix 90% of cases. I track all three as real-user metrics in production; lab Lighthouse scores lie about tail cases.

Pro Tips

  • INP landed as a Core Web Vital in March 2024 — FID is deprecated. If a resource predates 2024 and mentions FID, treat as outdated.

  • PageSpeed Insights shows lab + field side by side — field is what matters for SEO.

  • HireMe AI (即答侠) includes the before/after numbers from real optimizations so your answer sounds shipped, not studied.

Frequently Asked Questions

Do Core Web Vitals actually affect Google ranking?

Yes since 2021, as a tiebreaker among comparable pages. Not the dominant factor but non-zero.

What tools measure INP in production?

`web-vitals` NPM library + analytics endpoint. Third-party: Sentry, DataDog RUM, Google Analytics 4.

Worried About Going Blank in Your Interview?

HireMe AI listens to your interview in real-time, detects questions, and generates instant answer suggestions — so you never freeze up again.

Try HireMe AI Free