Largest Contentful Paint - How to Improve LCP
Largest Contentful Paint is one of the ways to measure a page speed from the user’s perspective. While various page performance tools can give you useful insights in regard to your performance, it does not always fully reflect the user experience. This is especially the case when we want to measure perceived page load speed for visiting users. Largest Contentful Paint (LCP), however, aims to solve this problem.
LCP is the most noticeable by the naked eye and perhaps the easiest to understand metric among the Core Web Vitals, which are the metrics Google uses to measure quality of a website to ensure visitors get great experience. Not only that, Google also stated that Core Web Vitals will be a part of its search engine ranking starting in 2021, so they are important for your SEO ranking.
In this article, I will explain about google LCP, how to test LCP, and several ways on how to improve LCP and optimize the LCP score of your website.
LCP essentially measures how long it takes for the largest content visible on your viewport to load. For a website, it means that content that appears above the fold will be measured for LCP. However, as the name implies, the LCP score will be affected by the single largest element.
Largest Contentful Paint Meaning
Unlike other metrics, LCP does not measure the actual file size of your content element. Rather than measuring in kilobytes and megabytes, LCP measures how much space the elements actually take on the user’s actual viewport. If an image or a large block of text overflows above and/or below the fold, only the visible part will be relevant to the LCP score.
Images and Videos
So, videos, images, and texts all will be considered in the LCP score, but the actual load time of the actual biggest element, even if it is a few paragraphs of text, will be your LCP score.
However, when it comes to images, it is a bit tricky. For example, if you scale down a 400×400 pixel image to 100×100, only the 100×100 dimension will be measured.
Scaled-up images work the opposite, as only the dimension of the original image is measured. So, if you scale up a 100×100 pixel image to 150×150, then only 100×100 pixel space will be measured as the dimension/size of that image element.
For text elements, only the actual space that the text takes on screen will be measured. If your text elements have CSS properties such as margin, padding, or border, the space taken up by those properties will not be considered.
LCP Measure of HTML Elements
According to guidelines from Google, the following elements are considered for the Largest Contentful Paint metric:
- Image elements
- Image inside an SVG
- Video elements (the cover image will be used to determine the size)
- Background images loaded via the url() function
- Block-level elements (p, div, h1 are among the many block-level elements. Full list can be found here.)
Interestingly, SVG is not measured for LCP. Google may add additional elements in the future as they gather more field data.
Is Largest Contentful Paint (LCP) Score Important?
As a part of the Core Web Vitals, LCP is one of the metrics Google uses for search engine ranking. Not only that, attaining a good LCP score will ensure that the perceived loading speed of your website is fast enough for visitors not to bounce.
Below, we’ll look at five reasons a good LCP is important for your site to make your web pages more visible to your target audience.
1. Google Invented and Recommended LCP as a Metric.
Since Largest Contentful Paint is a metric of Google’s invention, ignoring this heavily affects all developers and site owners. Starting May 2021, LCP became a default factor for measuring a website performance audit. As a Core Web Vital metric, LCP accounts for 25% of the Performance Score, making it one of the most important metrics to optimize.
2. Site Loading Speed Affects Rankings.
When it comes to technical SEO, Google has often emphasized the importance of web performance, particularly when it comes to mobile. It has also been indicated as one of the signals that the search engine’s algorithm uses to rank web pages.
With Google now using LCP to measure how long it takes for content to appear on the screen rather than simply begin to load, some pages might appear faster or slower than first thought. This can impact how well they rank on Google so getting your LCP below 2.5 seconds should be a priority for developers and website owners.
3. Slow Loading affects Page Crawling
Using LCP reporting, you can get a more accurate understanding of the load time of your web pages. This can highlight any areas that need improving to reduce your LCP.
Improving the loading time is crucial because it limits the number of web pages a search engine can crawl at one time, which can then impact your indexation. This will have a direct effect on how well your site ranks in SERPs.
4. User experience and SEO.
Google currently has algorithms in place that attempt to rank your web pages on delightfulness. Essentially, search engines don’t want to put web pages at the top of their search results if they are slow loading and difficult to navigate.
Obviously, the quicker page loading times mean a better experience for visitors. Therefore, a good LCP has a direct contributing factor in determining how ‘delightful’ your website is and whether visitors will have a good time visiting your pages. Those who have a better experience on your web pages will be more likely to convert.
5. Content is key to visitors
As the LCP metric places content at the forefront of user experience, improving it helps to increase your domain authority. Therefore, it shows the search engine that you’re a helpful and reputable source that deserves to rank higher on SERPs.
Because Largest Contentful Paint is all about the loading time of the primary content on the page, it ensures that visitors have a good experience when accessing and viewing it. This means getting your LCP and page speeds as quick as possible will impact user experience and therefore how visitors engage with your content.
You can read my other articles related to Core Web Vitals here:
What is a Good LCP Score?
The recommendation of Google is that the Largest Contentful Paint should be within 2.5 seconds of page load, for both mobile and desktop. Anything above 4 seconds is bad, and it will impact your overall PageSpeed performance score as well as search rankings.
Common Causes of Poor LCP Score are:
1. Slow Server Response Times
Slow server response times are often the results of problems with your back-end infrastructure, unoptimized database queries, or API responses that are taking a long time to resolve — all happening in your site’s background.
3. Client-side Rendering
4. Slow Resource Load Times
Large resources or visually impactful content on a page are bound to take a lot of time to load. If you have lots of unoptimized high-quality images, GIFs, and text boxes to be rendered above the fold, your LCP is going to be affected.
5. Lazy Load LCP Image
Lazy loading images is the process of delaying the loading of images until they are needed. This means images will not load until they are scrolled which helps the browser prioritize other resources that are more important.
If lazy loading is applied to above-the-fold content (like the LCP image), the browser may defer the LCP image in favor of other resources. As the LCP image is not immediately downloaded, it may slow down your LCP timing and make your page appear visually incomplete to the user for a longer period of time.
How to Measure LCP Score?
Largest Contentful Paint is both a lab and field metric and measurable for both using various available tools.
Google PageSpeed Insights and Search Console (navigate to Core Web Vitals section) are the field tools and easiest to use. It will also tell you a plethora of other useful Core Web Vital metrics, such as First Contentful Paint (FCP), First Input Delay (FID), and Cumulative Layout Shift (CLS). For debugging and in-house testing purposes, you can use Chrome Lighthouse or Chrome DevTools, as they are excellent lab tools.
One thing you must note, though, is that the PageSpeed Insights will tell only the LCP score of the webpage you are running the test on, but it won’t tell you exactly what element is the cause of your LCP score.
You can check this by loading Chrome DevTools (pressing F12 in Chrome will open it), and go to the Performance tab. Then, click on the Reload button, which will reload the page and record the performance.
When it finally loads, you can click on the LCP marker and look for Related Node in the Summary window. Hovering your mouse cursor on it will highlight the on-page element that is associated with your LCP score.
How to Improve LCP
It is important to understand here that there is no one-size-fits-all approach when it comes to optimizing the LCP score. One reason is because what is defined as the largest content element above the fold will differ from page to page.
This variability means that your approach to optimizing the LCP score for 75% of pages on your website has to cater to each specific need. However, in this article, I will guide you along some of the best practices as well as a general methodology on how to optimize your page to getting a good LCP score.
There are some common causes for a bad LCP score, and they can be categorized as below:
- Slow server response times
- Client-side rendering
- Slow asset load times
In the next section, I will explore different techniques that will address those causes.
How to Get Faster Server Response Times
When your web hosting server is slow to respond to the user’s browser, it takes longer to load anything else. Having a fast server response time will directly impact various page speed performance metrics, including LCP.
Read more about Reduce Initial Server Response Time (TTFB)
Optimizing your web server will definitely lead to a better TTFB result, which is a measure of server response times. However, if you are running on a shared hosting service, then this is going to be difficult to perform. If you don’t want to mess around with custom server configurations, you can instead move to a better and faster web host. I have done a comparison for the fastest web hosting services, and you can read all about it here.
Comparison of the same website, on two different hosting companies
Caching your website as static HTML and various other assets can reduce the server resource usage, and lead to a reduction in TTFB.
This can be achieved by using a cache plugin if you are using WordPress. For WordPress website owners, WP Rocket and WP Fastest Cache are two popular cache plugins with freemium and premium pricing models.
Serving your visitors using a Content Delivery Network (CDN) will further reduce the slow server response time as you can serve content from the nearest CDN server to the visitors, eliminating a few more milliseconds of load time from each asset. Your font assets will need to load faster if your largest content is a text block, and the same goes for image assets. So CDN definitely helps here.
By combining your static cached assets together with CDN, you can get a pretty fast performance out of your site.
Among the CDNs, Cloudflare has a free tier if you are just starting out. BunnyCDN is another paid CDN that I can recommend for its advanced features and very wallet-friendly pricing. They also have a 14-day (or 1,000 GB data transfer) free trial so that you can test it out before committing to their paid plans.
Improve Asset Load Times
Improving the loading times of the assets on your website will also have a direct and noticeable impact on the LCP score. As mentioned before, using cache and CDN can help with the loading times. But what about third-party assets from external sources? In this section, we explore the methods and techniques to improve the load times of both.
Lazy loading is a common method used by many, but it is not a good fit for LCP score if your largest content is an image.
Essentially, lazy load is to avoid loading unnecessary images below the fold. As a user scrolls, the images start to load. This is one good way to improve page speed.
However, if your largest content above the fold is an image, then it is an entirely different story. The reason behind this is that the web browser has to download lazy load script, parse, and execute first, only to find out that the images are in the viewport of the user, so they need to be loaded. This whole process results in images taking much longer to appear.
The bottom line is that if you are to improve your LCP score when the largest content is an image, just make sure that image is excluded from lazy loading.
DNS Prefetch & Preconnect
Your website may need to connect to assets from third-party services, such as Google Map or an embedded tweet from Twitter. In such cases, the waiting time for responses from such third-party origins can impact your LCP. To reduce this, we can use DNS prefetch and preconnect to establish a connection with the defined address as soon as possible.
The code looks like this:
<link rel="preconnect" href="https://example.com">
<link rel="dns-prefetch" href="https://example.com">
If you use any caching plugins that support this, you may also be able to enable DNS prefetching in the plugin’s settings.
Preload tells the web browser to request an asset as soon as possible. It is tempting to use preload on any assets that you deem important. However, in the case of optimizing for a better LCP score, it is better to preload only critical assets you need to render the above-the-fold contents. Another thing to note is that if your LCP is an image, it is a good strategy to preload the main image so that it will load earlier and faster And for further information on preload, check out this link: https://developer.mozilla.org/en-US/docs/Web/HTML/Preloading_content
However, things are different if your LCP is a block of text. In such a case, if you preload your font assets, it actually hurts your LCP. Basically, because the browser is busy loading your font asset before painting the text content, your LCP score will be bad.
I recommend not preloading your fonts, but using font-display: swap for your LCP text, which tells the browser to paint the text content first using the default browser font. Right after the font you are using is loaded, it will be swapped. You get a flash of unstyled text (FOUT), but this will improve your LCP.
Compress or Optimize Images
Unoptimized images are likely the most common source of bad LCP scores, as they can badly affect the loading time. A single unoptimized and uncompressed image can easily add a minimum of 1-3 seconds to load time, depending on file size.
There are two ways to handle image compression and optimization. One is by using image compression plugins such as Smush, Imagify, or ShortPixel, which will automatically compress images. Another great image service that supports WebP and on-the-fly image compression is Optimole. And the second way is to compress the images before uploading them using one of many compression online tools.
Having said that, my favorite method is to use a next-generation image format like WebP that maintains quality while compressing up to 90%. WebP is created by Google, and most modern web browsers support the format. If the browser does not support the WebP format, then the default image will be used as a fallback. The good news is that most modern browsers now have support for WebP format.
The easiest way to serve images as WebP format on a WordPress site is to use a CDN that supports image conversion on the fly. Cloudflare in their paid plans and BunnyCDN mentioned above support this, although BunnyCDN is likely more affordable.
You may also use WebP Express plugin which will convert the images to WebP on the fly.
It is really a trade-off in this case between LCP score and design aesthetics. But you might want to consider using a hero image instead of a slider. Or if a slider is a must-use, then you may want to test different slider plugins to see which one hurts your LCP score and other Core Web Vitals scores less.
While being a deceptively simple metric, the LCP is a very effective metric in measuring the delightful user experience. Since this is a part of Core Web Vitals that will have a direct impact on search engine ranking in the near future, it is important to optimize your Largest Contentful Paint score to be as low as possible.
Page Speed Optimization Course
Are you ready to learn more about improving Largest Contentful Paint (LCP) and more advanced website page speed optimization techniques? Head over to my WordPress page speed optimization course and deep-dive into all the amazing knowledge of website performance optimization!
Send me your site URL, and I will personally check your site and give you a few recommendations for free.