# LCP

> The LCP (Largest Contentful Paint) metric measures when the largest image or text block becomes visible.

## How do I improve Largest Contentful Paint (LCP)?

The metric that reports the render time of the largest image or text block visible in the viewport. A good value is 2.5 seconds or less. Improved by preloading the hero image, `fetchpriority` and fast server responses.

- Topic: Performance
- Type: concept

## Example

Wrong:

```html
<img
  src="/hero.jpg"
  loading="lazy"
  alt="Team at work"
>
```

Right:

```html
<img
  src="/hero.jpg"
  fetchpriority="high"
  width="1200"
  height="600"
  alt="Team at work"
>
```

The hero image is the LCP element, so it loads eagerly with high priority instead of waiting for lazy loading.

## Common mistakes

- Adding `loading='lazy'` to the hero image, which delays the main content.

## Key points

- The LCP image is not lazy-loaded and has `fetchpriority='high'`.
- An LCP image set in CSS background or loaded by JS is discovered early with `<link rel='preload'>`.
- Images have responsive `srcset` and modern formats, so the hero is not a huge file.

## Interview questions

### What is a good LCP score?

2.5 seconds or less at the 75th percentile of visits is good, and over 4 seconds is poor.

### Which elements count for LCP?

Images, `<image>` inside SVG, video poster images, elements with a CSS background image, and block-level elements with text.

### How do I find the LCP element on my page?

The Performance panel in browser dev tools marks it, and a `PerformanceObserver` for 'largest-contentful-paint' reports it in code.

## Related cards

- [Core Web Vitals](https://wonderium.dev/web/core-web-vitals.md)
- [\[fetchpriority\]](https://wonderium.dev/html/fetchpriority.md)
- [\[rel="preload"\]](https://wonderium.dev/html/rel-preload.md)
- [\[loading\]](https://wonderium.dev/html/loading-attribute.md)
- [TTFB](https://wonderium.dev/web/ttfb.md)

---

- Level: [Web Platform](https://wonderium.dev/web.md)
- HTML version: https://wonderium.dev/web/lcp
- Last updated: 2026-11-25
