largest contentful paint

What is the largest contentful paint? How to fix Largest Contentful Paint Step by Step (2022)

What is the largest contentful paint? The largest contentful paint is a metric that shows when the browser starts to paint its content. This article will introduce you to fixing the largest contentful paint step by step.

What is LCP? (largest contentful paint)

The largest-contentful-paint (LCP) determines how long it takes for the web page’s largest contentful (DOM) element to be displayed on its visible portion of the browser window once the web page is requested.

The LCP is an indicator of user experience and web page performance, but most importantly, it’s a visual cue that the page is “ready to be read.”

There are three events in the largest contentful painting. The contentful elements contain:

  • HTML-like images (including background images).
  • SVG or canvas.
  • No div or background color.

The browser performs several “paint” operations while rendering a web page. The LCP measures the largest paint on the page above the fold.

Do search engines give credit to the Largest Contentful Paint for ranking websites?

Yes, it is. The LCP is one of the essential on-page factors for search engines like Google. Everybody who knows about contentful paint sees that it can be imperative for a website to appear in search results, and it is one of the most important factors that search engines like Google look at when ranking a site. The contentful paint is also significant for mobile sites because Google has a mobile-friendly algorithm that punishes sites that are not mobile-friendly. So, how much of the contentful color is needed to rank well in search results?

How to fix Largest Contentful Paint

Why is Contentful Paint important for your visitors?

While surfing the internet, speed is a crucial factor. A recent study by Google found that the probability of leaving the site doubles with a loading time of 3 seconds. The result doesn’t come as a surprise: most internet users feel that slow-loading websites are highly annoying and thus abandon them shortly after surfacing on them.

The Best LCP According to Google

Google says that getting the first byte of a web page should be less than 2.5 seconds. A latency between 2.5 and 4 seconds is considered moderate and more than 4 seconds is very slow. For latency, lower is always better.

First Meaningful Paint

The First Meaningful Paint metric is all about website render performance and specifically on how long it takes to display the first pixels of your site.

TIP: TIP stands for Time To Interactive Page, which means that the page has been fully rendered and can be used by the user instantly without waiting for additional resources to load.

The FMP metric is calculated as the point in time when 50% of the critical resources are received and processes are executed, which means that it’s enough for your page to be rendered completely.

The FMP tests how quickly a page loads and paints on the screen and is measured in the time it takes for half of the above-the-fold content to be displayed.

What are render-blocking resources? And how do they impact “Largest Contentful Paint”?

Render blocking resources are HTML elements that block the browser from printing the content. If a resource is considered render-blocking, it will delay displaying content to the user until it has been downloaded and processed. For example:

When an image is requested, it will be blocked from displaying until downloaded. It’sIt’s a bit like when the images on a web page are blue with an icon that says, “Loading.” Then, once all photos have finished downloading and processing, they will be displayed (the blue loading icons will disappear).

CSS and JavaScript are two types of render-blocking resources, and CSS is used for presentation—styling. JavaScript is used to enhance functionality — interactions.

When you optimize the LCP, you can reduce the time it takes for the page to render. Optimization strategies include removing generated resources from the critical rendering path, deferring non-critical resources, and removing unnecessary JS.

How to Improve LCP

With this knowledge, we will examine the concept of LCP timing and how one can improve it.

If you don’t feel confident about making this improvement by yourself, contact a professional to get help.

Image Optimization can Improve LCP.

Always use the most miniature images possible. To reduce image size, use an optimization plugin like SSmush or Hummingbird. You can also minimize LCP load by using a CDN.

Choose a Good Hosting Service

Choosing a good hosting service is as essential as selecting a suitable domain for your website. The two services are intertwined and need to be in sync. If you choose an average hosting service, your site will have average performance and average loading times. If you select an excellent hosting service, you will enjoy top performance and quick loading times.

The core web vitals of the site include page load speed, server uptime, disk space, database storage, bandwidth limits, security features, and customer support. It’sIt’s vital that your web host meets or exceeds these standards, or else your site will not have a good start in life.

USE CDN

The browser waits for the server to send back a file, which takes too long to send. You’ll fix the issue by speeding up your site, using a CDN, and establishing an excellent third-party connection. In other words, load time is slow, and the LCP score isn’t great. You’ll fix the issue by using a content delivery network, establishing third-party connections, and improving your Time To First Byte.

Faster Server Response Time

Reducing the time for the browser to render a page can significantly reduce the largest contentful paint. According to new research by Google, this is especially true for pages with heavy use of JavaScript and CSS. The study found that faster server response time can reduce the largest contentful paint by up to 94%. It means that even if a page is slow to render, it’s still possible to have a fast first paint if the server responds quickly.

Slashing server response times get top billing in PageSpeed Insights.

Here’sHere’s a list of steps you can take to solve this problem:

Upgrade Your Hosting

fast hosting
SiteGround

If you’re on a cheap, shared hosting plan, you need to upgrade. It’s impossible to have a fast website with a slow host server. Even if your site is getting traffic from thousands of visitors every day, it will be dead if your web host doesn’t have enough bandwidth capacity. Using managed WordPress or cloud hosting can save money on expensive dedicated servers.

Optimize Server

You’ve done the hard part: you wrote a blog post and published it. Now your work is done. Not so fast! It would help if you still did several things to ensure that your post is optimized for search and delivers the best possible user experience to your readers. The most important thing you can do after publishing is to optimize your server.

Reduce the amount of third-party code on the site.

One of the easiest ways to reduce the amount of code to be executed on the server and thus improve metrics like Time to First Byte, First Contentful Paint, and LCP is to minimize the site’s reliance on 3rd party plugins, tools, and libraries. Free resources abound, so take advantage of them. But there is also a substantial amount of paid products that can help you build a fast, lightweight site, and we recommend using them.

Make the Most of Caching

Make sure to take advantage of caching whenever possible. Caching can help make your site load more quickly. Many types of assets, such as images and logos, can be cached for long periods, which can help make your website’s performance even better. In addition, if you make all the HTML on your site static, you could potentially cache it, too. It will likely lessen the time it takes for your pages to load–especially when visitors come to one page on your site from another.

Utilize Service Workers

To reduce the size of HTML payloads, use service workers. Service workers let you avoid the repetition of common elements. Once installed, they request the bare minimum of data from the server and transform it into a complete HTML doc.

JavaScript and CSS Optimization

Remove Unnecessary CSS

Remove unnecessary CSS from your site by finding unused classes, deleting code that isn’t necessary, and optimizing what you have left. Your loading times will increase if you strip your website of these unnecessary CSS elements.

Optimize CSS delivery

largest contentful paint

Some cache plugins, such as WP Rocket, have an option to optimize CSS delivery. No caching plugin can guarantee that every visitor always downloads the most optimized version of a stylesheet. Still, it’s worth checking whether your cache plugin is optimizing the delivery of your stylesheets. If not, you can set a fallback for all visitors so that a critical stylesheet is always available, generate a necessary stylesheet and clear your cache.

Third-party JavaScript

Code from external domains—can reduce your page load speed, causing a higher largest contentful paint if it’s loading above the fold. Use the Lighthouse report to identify third-party code that can move to a local server. You can also optimize web fonts using plugins like OMGF, Flying Analytics, and WP User Avatar.

Manification HTML, JavaScript, and CSS

When minifying HTML, JavaScript, and CSS code for your website, you can decrease the load time by removing all characters that aren’t needed. Minification is a process of removing extra spaces and characters to reduce the number of bytes your site takes up and improve First contentful paint timing.

Load JavaScript While Needed

You can harness the power of JavaScript to load the JavaScript files only when needed. For example, you can use Perfmatters and Assets Cleanup to load the JavaScript files only on the pages on which they are required. Perfmatters and Assets Cleanup are plugins that can help you with this aspect.

Delay JavaScript

Delay the loading of JavaScript files until a user interaction is made. This way, neither Google PageSpeed Insights nor Lighthouse will report that specific JavaScript files should be delayed. To address this PageSpeed audit, we’ll be delayed loading some JavaScript files. It will not solve the recommendation, but it’ll help us improve our LCP score.

Deferring JavaScript

By deferring JavaScript, the browser will load and execute the JavaScript files only after the HTML document is fully parsed and the DOM tree has been built. Since there won’t be anything to block the process, rendering will be much faster, and users will experience a better experience — resulting in an improved LCP metric.

By using the defer attribute in JavaScript files, browsers can detect and load resources in the background while loading the HTML document without interruption.

Example of deferring attribute:

<script defer src=”/example-js-script”></script>

Leave a Comment

Your email address will not be published.

Scroll to Top