WEB PERFORMANCE INTERVIEWS
Web performance interview questions
151 questions about web performance, the way interviewers ask them: 117 to explain, 21 where you say what some JavaScript or a real page in Chrome logs, and 13 where you write the function. 36 easy, 100 medium, and 15 hard. Every page's answer is what real Chrome did with it, the same in three loads in a row, and every code answer passes its tests.
Every question is free to read. Sign in with Google to see the answers: the short version to say in the interview, why it's true, and what they'll ask next.
151 of 151 questions
Why speed matters & the metrics
- What is web performance, and what are you actually optimizing?
- Why does page speed matter to a business?
- What's perceived performance, and how can a page feel faster without being faster?
- What's the difference between lab data and field data?
- Why do performance teams look at the 75th percentile, not the average?
- What are the Core Web Vitals?
- Which metric tells you about loading, interactivity, and visual stability?
- What response times feel instant, and when do people lose focus?
- How are these five numbers rated?
- What's the 75th percentile of these samples?
- Write a function that returns the share of good samples.
Core Web Vitals: LCP, INP, CLS
- What is Largest Contentful Paint, and what counts as the largest element?
- Why did INP replace First Input Delay?
- What is Interaction to Next Paint?
- How is Cumulative Layout Shift calculated?
- What are session windows in CLS?
- What are the thresholds for good LCP, INP, and CLS?
- When does the browser stop reporting LCP candidates?
- Which layout shifts don't count toward CLS?
- What CLS do these layout shifts add up to?
- What INP do these interactions give?
- Which element does the browser report as the LCP?
- Write a function that finds the element behind the largest layout shift.
Measuring: lab, field & the performance APIs
- How does Lighthouse score performance?
- Why can Lighthouse say fast while real users see slow?
- What is the Chrome UX Report?
- How would you find out why a page is slow in the Performance panel?
- What does
buffered: truedo on a PerformanceObserver? - What can Navigation Timing tell you about a page load?
- Why do some Resource Timing entries show zero sizes and times?
- What are performance marks and measures for?
- How are Long Animation Frames better than long tasks?
- What should a real user monitoring setup collect and how should it send it?
- What does this Lighthouse score calculation print?
- Write a function that turns a navigation entry into a waterfall of phases.
Networks, protocols & TTFB
- What's the difference between latency and bandwidth?
- What happens before the first byte of a page arrives?
- How does HTTP/2 make loading faster than HTTP/1.1?
- What does HTTP/3 fix that HTTP/2 couldn't?
- What makes TTFB slow, and how do you fix it?
- How does a CDN make pages faster?
- Gzip, Brotli, or Zstandard: what's the difference?
- What are 103 Early Hints?
- Why does the first 14 KB of HTML matter?
- How long do these connection phases take?
- Write a function that estimates load time from round trips.
Caching & service workers
- What does
Cache-Control: max-agedo? - What's the difference between
no-cacheandno-store? - Why do hashed file names let you cache forever?
- How does an ETag save bandwidth?
- What does the
Varyheader do to caching? - What does
stale-while-revalidatedo inCache-Control? - What's
s-maxage, and when do you use it? - Which service worker caching strategy would you use for each kind of file?
- What is the back/forward cache, and what stops a page from using it?
- Is this cached response fresh?
- What does the second load log for each file's transfer size?
- Write a cache-first service worker handler.
The critical path, resource hints & priorities
- What is the critical rendering path?
- Why does CSS block rendering?
- Preload, prefetch, and preconnect: when do you use each?
- What does
fetchprioritychange? - What is the preload scanner, and what hides files from it?
- Should you inline critical CSS?
- Why shouldn't the LCP image be lazy-loaded?
- Why is a CSS background image a slow LCP?
- How does streaming HTML help the first paint?
- Which priority does Chrome give each image?
- In what order do these scripts run?
- Write a function that builds the preload links a page needs.
Images, video & fonts
- Which image format should you use?
- How do
srcsetandsizespick an image? - How does
loading="lazy"work, and when shouldn't you use it? - Why do images need width and height attributes?
- What does an image CDN do?
- How do you make a video or an embed cheap to load?
- What do the
font-displayvalues do? - How do you load web fonts fast?
- How do you stop a font swap from shifting the layout?
- Which
srcsetcandidate does this pick? - Which images does this page request before you scroll?
- Write a function that picks a fallback font's size-adjust and overrides.
JavaScript cost & third parties
- Why is a kilobyte of JavaScript more expensive than a kilobyte of image?
- What is code splitting?
- How does tree shaking work, and what stops it?
- How do you find what's making a bundle big?
- Do you still need polyfills?
- How do you keep third-party scripts from slowing a page?
- What's a facade for a third-party embed?
- What's the difference between minifying and compressing?
- What does
modulepreloaddo? - When does the dynamically imported module run?
- Write a function that splits a route map into chunks.
The main thread & responsiveness
- What is a long task?
- What are the three parts of an interaction's latency?
- How do you break up a long task?
- What does
scheduler.yield()do thatsetTimeoutdoesn't? - When should work move to a web worker?
- When does the browser get a chance to paint?
- What is
requestIdleCallbackgood for? - Why can a fast event handler still give a slow INP?
- How do you make typing in a search box feel instant?
- In what order do the yield continuation and the timeout run?
- Which of these tasks are long, and what's the blocking time?
- Write
runWhenIdle(task), which runs a task in an idle callback, or after a timeout, and can be cancelled.
Rendering, layout shifts & animation
- What are the steps of the rendering pipeline?
- What is a forced synchronous layout?
- Which CSS properties can animate without layout or paint?
- What does
will-changedo, and why not use it everywhere? - What does
content-visibility: autodo? - What does CSS
containdo? - What causes layout shifts, and how do you fix them?
- How do you keep an ad slot from shifting the page?
- How does a virtual list render 10,000 rows fast?
- What CLS does this page log?
- What is this layout shift's score?
- Write a function that finds which animations aren't compositor-friendly.
Rendering strategies, frameworks & navigations
- CSR, SSR, SSG: what does each do to the first paint?
- What does hydration cost?
- What is streaming server rendering?
- What are islands, and what do they save?
- How are single-page app navigations measured?
- What are speculation rules, and when would you prerender?
- How do you make a page eligible for the back/forward cache?
- Do view transitions slow navigations down?
- When does rendering at the edge help TTFB?
- How do Server Components change how much JavaScript ships?
- What does Chrome report when a single-page app changes route?
- Write a function that picks speculation rules for a page's links.
How browsers do it inside
- How does Chrome decide a request's priority?
- What do the main thread, the compositor, and the raster threads each do?
- How does V8 run JavaScript: parsing, tiers, and the code cache?
- How does the browser compute LCP?
- How does the browser compute a layout shift?
- How does HTTP/2 prioritization work, and what replaced its tree?
- What happens in a QUIC connection's first round trip?
- Where does image decoding happen?
- What happens in one frame of the event loop?
- What does this trace's self time add up to?
- Write a function that orders a server's responses by their RFC 9218 priorities.
Budgets, monitoring & debugging slow pages
- What is a performance budget?
- How do you catch performance regressions in CI?
- How do you monitor performance in production and alert on it?
- A page's LCP got worse last week: how do you find out why?
- Users say the app feels laggy: how do you debug INP?
- How do you A/B test a performance change?
- How do you make the business case for performance work?
- How do you test for low-end phones and slow networks?
- Design a real user monitoring pipeline.
- Which budget lines does this build break?
- Write an alert rule that fires when the daily p75 stays over a line for several days in a row.