Largest Contentful Paint (LCP) optimization: get LCP under 2.5 seconds. A guide to image optimization and TTFB.

LCP is a critical user experience metric and a Google ranking factor. When a user navigates to your page, they do not care about the total page load time. They care when they can see the main content and start reading or interacting. LCP measures exactly that moment: when the largest content element becomes visible. Get LCP right, and your page feels fast. Get it wrong, and your page feels slow, even if other metrics are fine.
Optimizing LCP requires a three-pronged approach: improving server response time (TTFB), eliminating render-blocking resources, and optimizing images. Each approach addresses different LCP bottlenecks. The combination delivers dramatic improvements.
Largest Contentful Paint (LCP) is the render time of the largest visible content element on your page. This could be a large image, video, headline, or text block. LCP measures from when the user navigates to your page until that element becomes visible. Google's LCP documentation provides detailed technical information and optimization strategies.
LCP is not a binary pass/fail metric. It is a continuous score. Google has determined that LCP under 2.5 seconds is "good," LCP between 2.5-4 seconds needs improvement, and LCP over 4 seconds is poor. Users perceive pages with LCP under 2 seconds as very fast. Pages with LCP of 3-4 seconds feel noticeably slower. Pages with LCP over 5 seconds are often abandoned.
LCP changes during page load as larger content elements appear. If a huge image loads at the 3-second mark, LCP jumps from 1 second to 3 seconds. This is important: you cannot just optimize the initial paint time. You must ensure that all large content elements load quickly.
Time to First Byte (TTFB) is the time from navigation start until the server returns the first byte of the HTML document. TTFB determines the floor for LCP. If TTFB is 2 seconds, LCP cannot be better than 2 seconds because the browser has not even received the HTML yet. Reducing TTFB is prerequisite to reducing LCP.
Good TTFB is under 600 milliseconds. TTFB between 600-1800ms needs improvement. TTFB over 1800ms is poor. If your TTFB is slow, focus on server optimization first. No amount of frontend optimization can make up for a slow server.
Common causes of slow TTFB: inefficient backend code, database queries, or server overload. Slow hosting also causes high TTFB. Shared hosting is often extremely slow. Upgrade to VPS or cloud hosting for better performance. Use a CDN to reduce TTFB by serving content from servers near your users.
PageSpeed Insights shows your TTFB in the "Server response time" section. If TTFB is a bottleneck, it will be highlighted as a priority.
LCP depends on what the largest content element is on your page. On a blog post, the largest element might be a large hero image. On a product page, it might be a product photo. On a news site, it might be an article headline. Identifying the LCP element is the first step to optimizing it.
Use Chrome DevTools to identify the LCP element. Open DevTools, go to Performance tab, start recording, and reload the page. In the Performance recording, look for the "Largest Contentful Paint" mark. Hover over it to see which element triggered LCP. Once you know the element, optimize it.
The LCP element is often an image. Images are large and load after HTML is parsed. Optimizing image loading has the biggest impact on LCP for most sites. Images that are below-the-fold can be lazy-loaded, speeding up LCP for above-the-fold content.
Preloading tells the browser to start downloading a resource early, before it is needed for rendering. Preload your LCP image or other critical resources using `` tags in the HTML head. This tells the browser "start downloading this resource immediately."
Example: `` tells the browser to start downloading the hero image immediately, not waiting for CSS to be parsed. This can reduce LCP by 100-500ms depending on resource size.
Be cautious with preloading. Preloading too many resources wastes bandwidth. Preload only the most critical resources (hero image, critical fonts, essential CSS). Google's Core Web Vitals optimization guide explains preloading best practices.
If your LCP element is an image, optimize the image file size and loading strategy. Three tactics:
Compress the image. Use tools like TinyPNG, ImageOptim, or Squoosh to compress without losing quality. JPEG compression can reduce file size 10-40x. Every 100KB of image size adds 100-200ms to LCP on 4G networks. Compression is high-ROI.
Use modern formats. WebP is 25-35% smaller than JPEG. AVIF is even smaller. Use the HTML `
Specify image dimensions. Including width and height attributes prevents layout shift and allows the browser to reserve space before the image loads. This does not directly improve LCP, but it improves Cumulative Layout Shift (CLS), another Core Web Vitals metric.
Render-blocking CSS prevents the browser from rendering the page until CSS is downloaded and parsed. Large CSS files delay rendering. Minimize render-blocking CSS by inlining critical CSS and deferring the rest.
Critical CSS is CSS needed for above-the-fold content. Inline this CSS in `