LCP (Largest Contentful Paint)
A Core Web Vital measuring the time from navigation start until the largest visible image or text block finishes rendering in the viewport
Table of Contents
Structure Diagram
What is LCP (Largest Contentful Paint)?
A Core Web Vital measuring the time from navigation start until the largest visible image or text block finishes rendering in the viewport. It is a core concept in Performance & Optimization within Web Dev.
Core Principles
Largest Contentful Paint (LCP) measures when a page feels loaded to a human visitor—specifically, the timestamp when the largest visible image, <video> poster, or text block in the initial viewport finishes painting.
Debugging LCP effectively means breaking it into four sub-parts: 1) TTFB, 2) Resource Load Delay (time until the browser discovers the image URL), 3) Resource Load Duration, and 4) Element Render Delay (blocked by CSS/JS).
Practical Takeaways
- Make the LCP asset discoverable in raw HTML: Avoid hiding the hero image behind client-side JS fetches or deep CSS
background-imagerules. Put an<img>in the initial HTML withfetchpriority="high"and never addloading="lazy". - Serve modern formats and responsive sizes: Use AVIF/WebP with
srcsetandsizesso mobile devices download appropriately sized assets. - Eliminate render-blocking bottlenecks: Defer non-critical scripts, inline critical CSS, and serve HTML from a CDN to compress both TTFB and render delay.
Notable Examples
- Product detail hero photos: Marking the primary product image as high priority while lazy-loading secondary gallery slides.
- Editorial landing pages: Combining SSG/CDN delivery with preloaded webfonts so headline text blocks paint in under 1.5 seconds.