This website uses cookies

Our website, platform and/or any sub domains use cookies to understand how you use our services, and to improve both your experience and our marketing relevance.

✨ Vultr and Linode are back on Cloudways! VIEW PLANS→

How to Improve First Contentful Paint (FCP) in WordPress (Server-Side and Front-End Optimization)

Updated on February 28, 2024

11 Min Read
How to Improve First Contentful Paint (FCP) in WordPress

Ever feel like your WordPress site takes ages to load? If so, you’re not alone. Slow websites frustrate users and hurt your search ranking. But fret not, WordPress developers! This article simplifies improving a key metric: First Contentful Paint (FCP).

Think of FCP as the moment your user sees the first bit of actual content, like text or an image. The faster it appears, the happier they are. Slow FCP? They might click away before seeing your useful content.

In this article, I’ll break down FCP improvements into easy steps that even coding ninjas-in-training can understand. I’ll talk about using special styles (“critical CSS”) and removing any roadblocks (“render-blocking resources”).

What Is FCP and Why Is It Important?

FCP is a crucial metric that measures the time it takes for the browser to render the first piece of meaningful content on your page. This could be text, an image, an icon, or any element that isn’t just a loading spinner or background color.

In essence, it’s the moment your visitor finally sees something tangible, a sign that your website is alive and kicking. A speedy FCP tells visitors, “Hey, we’re here and ready to show you something awesome!”

On the other hand, a slow FCP conveys an image of sluggishness and potential technical issues. This can lead to frustrated visitors bouncing away before even experiencing your content, impacting your engagement and conversion rates.

Improving FCP is about ensuring that your website delivers that initial “wow” moment promptly. By taking control of how your page renders, you can improve user experience, boost SEO rankings, and create a website that truly shines.

Don’t Let Slow Load Speeds Hold Your Website Back!

Switch to Cloudways now, accelerate your load speed, and enhance user experience.

What Is a Good FCP Score?

Aim for an FCP of 1.8 seconds or less. This timeframe ensures most users perceive your site as fast and responsive. Google considers this a good user experience.

While 1.8 seconds is the target, strive for even faster. The 75th percentile of page loads, segmented across mobile and desktop devices, should ideally fall within this range. This ensures consistency and caters to diverse device types and network speeds.

Here’s the breakdown:

0-1.8 seconds: Good! Users perceive your site as lightning-fast.
1.8-3 seconds: Still good, but aim for improvement to avoid potential user frustration.
3+ seconds: Poor! Visitors might bounce due to perceived slowness.

– Source: web.dev

Diagnosing Your FCP Issues

Tools like Lighthouse, Google PageSpeed Insights, and GTmetrix can analyze your website and pinpoint specific elements delaying your FCP. Look for culprits like:

  • Large or unoptimized images
  • Render-blocking resources
  • Heavyweight fonts
  • Overly complex JS and CSS

Once you’ve identified the suspects, dig deeper to understand their impact. Tools like Google PageSpeed Insights offer detailed performance analysis, helping you pinpoint specific scripts, styles, and network requests affecting FCP.

Open Google PageSpeed Insights, enter your website URL in the search bar, and click Analyze.

  • This will generate a detailed report highlighting areas where improvements can be made to improve FCP and overall performance.

  • Keep an eye on the FCP metric. It tells you how long it takes for the first bit of real content to show up on your visitor’s screen.

  • Next, check out the Diagnostics section in PageSpeed Insights. It lists specific ways to improve FCP on your site.

Strategies to Improve FCP

To create truly engaging experiences, we need to tackle FCP on both fronts: server-side and front-end optimization. Let’s look at the actionable strategies for each:

Server-Side Optimization

This is about making changes on the server to quickly send the necessary data for displaying the webpage. This can be done by using good caching methods, compressing files before sending and making the server respond faster.

1. Reduce Server Response Time (TTFB)

Time to First Byte (TTFB) is a measurement used as an indication of the responsiveness of a web server or other network resource.

Reducing TTFB can be achieved by optimizing your server’s software configuration, ensuring efficient database queries, and minimizing HTTP requests.

1.1. Choose a Better Hosting Provider

The choice of hosting provider can significantly impact your site’s performance. Look for providers that offer excellent uptime, strong security measures, and high-speed hardware.

Cloudways can be a good choice because it prioritizes performance and optimization. Moreover, It has a reliable uptime, ensuring that your website is always accessible to users. Let’s see what Cloudways offers to improve your website’s performance. You can also read more about it in detail here.

1.2. Optimize Server Software

This involves fine-tuning your web server software configuration to ensure optimal performance. This can include enabling compression, optimizing your SSL/TLS configuration for speed and security, and configuring your server to deliver static files efficiently.

1.3. Use a Content Delivery Network (CDN)

A CDN is a network of servers distributed across various locations around the globe.

When a user requests a file from your site, it is delivered from the nearest server in the CDN, resulting in faster load times. CDNs also help to protect your site from traffic spikes and DDoS attacks.

For Cloudways users, integrating Cloudflare CDN offers additional benefits beyond just geographical distribution. It seamlessly integrates with your Cloudways account, simplifying setup and management. Also, Cloudflare CDN includes features like:

2. Leverage Server-Level Caching

Server-level caching can significantly improve your website’s speed by storing a copy of the site’s pages in a temporary storage location. This reduces the amount of work required to generate a page view, resulting in faster load times for your users.

2.1. WP Plugins for Server-Level Caching

There are several WordPress plugins available that can help you implement server-level caching. These include:

  1. W3 Total Cache: This plugin offers a comprehensive suite of caching options, including page caching, object caching, and browser caching.
  2. WP Super Cache: This user-friendly plugin generates static HTML files from your dynamic WordPress site. The web server will use these HTML files instead of processing the heavier PHP scripts.

2.2. Configure Server-Side Caching Rules

Configuring server-side caching involves setting rules for how and when your server should cache content. Here are some general steps:

  • Enable Caching: This is typically done through your server’s configuration file (e.g., .htaccess for Apache servers).
  • Set Cache-Control Headers: These headers define which types of files to cache and how long to store them.
  • Configure ETags: ETags help the browser determine if the cached content has changed since it was last cached.
  • Use Expires Headers: These headers tell the browser how long to cache the content.

Front-End Optimization

This is about making changes on the user’s device to display the webpage faster. This can be done by reducing the use of resources that slow down the page, improving CSS and JavaScript files, and loading images only when needed.

3. Eliminate Render-blocking Resources

Render-blocking resources, such as CSS and JavaScript, can slow down your website’s load time. Here’s how to address this issue:

3.1. Identify Critical CSS and Load It First

Critical CSS is the minimum set of blocking CSS required to render the above-the-fold content of a web page. Identify and inline the critical CSS in the HTML document and defer the loading of all other CSS styles.

3.2. Defer or Async-loading Non-Critical JavaScript

Non-critical JavaScript can be deferred or loaded asynchronously to speed up page rendering. Use the defer or async attribute in your script tags to achieve this.

Use the defer attribute in your script tags to defer the loading of non-critical JavaScript until the HTML document has been fully parsed:

<script src="non-critical.js" defer></script>

Alternatively, use the async attribute to load the script asynchronously:

<script src="non-critical.js" async></script>

3.3 Remove Unused Scripts and Styles

Eliminate unnecessary bytes by removing unused scripts and styles. The following tools can help identify and remove unused CSS.

  1. PurifyCSS: This tool can be used to remove unused CSS. It checks your source files and removes unused selectors from your CSS.
  2. UnCSS: Similar to PurifyCSS, UnCSS also removes unused styles from your stylesheets.
  3. Chrome DevTools: The Coverage tab in Chrome DevTools can help identify unused JavaScript and CSS code.

Fastest WordPress Hosting For Developers & Agencies at just $11/Month*

Experience blazing fast server speeds with Cloudways LAMP + NGINX hybrid stack. Improve your Core Web Vitals and supercharge your WordPress with Cloudways Hosting.

4. Optimize Your CSS Structure

Optimizing your CSS can lead to faster render times and a better user experience. Here’s how:

4.1. Minify and Reduce CSS Files

Minification removes unnecessary characters from code to reduce its size, thereby improving load times. Compression reduces the size of CSS files to optimize the delivery to the browser. Breeze offers built-in CSS minification, automatically minimizing all your CSS files for improved loading times. It also provides separate options for inlining critical CSS, further enhancing FCP.

4.2. Preload Key CSS Requests

The preload attribute in the <link> tag allows the browser to download key CSS files as soon as possible, which can reduce the time it takes to render the page. Here is an example of how to use the preload attribute to preload a CSS file:

<link rel="preload" href="styles.css" as="style">

This tells the browser to start downloading the styles.css file right away, as it’s likely to be needed soon. The as=”style” attribute is important as it helps the browser set the correct priority for downloading the resource.

💡 Note: Be careful with preloading too many resources, as it can slow down performance by using up needed bandwidth. It’s recommended to only preload critical CSS files for the initial page load.

5. Avoid JavaScript-Dependent Elements Above the Fold

JavaScript-dependent elements can slow down your website’s load time. Here’s how to address this issue:

5.1. Use Alternative Solutions for Animations and Sliders

Consider using CSS animations or HTML5 video as alternatives to JavaScript-based animations and sliders. These alternatives can provide similar functionality with less impact on page load time.

CSS animations are a powerful feature that can replace JavaScript animations. They are performed by the browser’s rendering engine, which can use hardware acceleration for better performance.

Here is an example of a simple CSS animation:

@keyframes slide {
  from { transform: translateX(0); }
  to { transform: translateX(100px); }
}

.myElement {
  animation: slide 2s infinite;
}

HTML5 video can be used to create rich, dynamic content without relying on JavaScript. It is supported by all modern browsers and can be controlled using the standard HTML5 video API.

<video width="1080" height="720" controls>
  <source src="movie.mp4" type="video/mp4">
  Your browser does not support the video tag.
</video>

5.2. Delay Non-Essential JavaScript Execution

Non-essential JavaScript can be deferred until after the page has loaded. This allows the browser to render the page more quickly and improves the user experience.

The defer attribute in the <script> tag allows the browser to execute the script after the HTML document has been fully parsed.

<script src="script.js" defer></script>

The async attribute allows the script to be fetched in parallel with other resources and executed as soon as it is available, without blocking the rendering of the page.

<script src="script.js" async></script>

JavaScript provides events such as DOMContentLoaded and load that can be used to delay the execution of non-essential JavaScript until after the page has loaded.

window.addEventListener('load', function() {
  // Your code here
});

6. Avoid Lazy Loading Images Above the Fold

Lazy loading can improve performance by only loading images as they’re needed. However, it’s important to avoid lazy loading images that appear above the fold. Here’s how:

6.1. Preload Critical Images

Preloading allows the browser to download important images as soon as possible. This reduces the time it takes to render the page and improves the user experience. Here’s how you can do it:

  • Use the preload value of the rel attribute in a link element in your HTML. This tells the browser to start downloading the specified resource as soon as possible.
  • If your server supports HTTP/2, you can use Server Push to send resources to the client before they are requested. This can be particularly effective for preloading critical images.

6.2. Use Above-The-Fold Image Optimization Techniques

Optimize images that appear above the fold by compressing them, resizing them appropriately, and using modern image formats like WebP.

7. Optimize and Compress Images

Image optimization can significantly reduce page load times, reduce bandwidth usage, and improve the user experience. Here’s how:

7.1. Choose the Right Image Format and Compression Level

Different image formats and compression levels can be used depending on the content of the image. For example, use JPEG for photographs, PNG for graphics with few colors, and SVG for vector images.

Imagify lets you resize and compress images effortlessly with a single click and is considered among the best WordPress image optimization plugins. Here are the instructions:

  • First, install the Imagify plugin on your WordPress site and activate it.
  • Use your email address to generate the API key. Once generated, copy this key and paste it into the following path: WordPress Dashboard > Settings > Imagify.
  • Go to the WordPress Dashboard → Settings → Imagify → Optimization Section.

In the optimization section, select the option Display images in WebP format on the site and Use <picture> tags.

7.2. Use Responsive Image Techniques

Responsive image techniques, such as the srcset attribute in HTML, allow the browser to choose the most appropriate image source based on the device’s screen size and resolution. This can reduce bandwidth usage and improve load times on mobile devices.

8. Reduce Your DOM Size

Reducing the size of your Document Object Model (DOM) can lead to better performance. Here are some strategies:

8.1. Minimize HTML Markup

Keep your HTML clean and lean. Remove unnecessary tags, use semantic HTML elements, and avoid inline styling where possible.

To keep your HTML clean and lean, you can:

  • Use HTML validators such as W3C Markup Validation Service to identify and remove unnecessary tags.
  • Use semantic HTML elements like <article>, <section>, and <nav> to provide more information about your content.
  • Use external CSS stylesheets or internal CSS in the <head> section instead of inline styles.
<!-- Good -->
<head>
    <style>
        .myClass {
            color: blue;
        }
    </style>
</head>
<body>
    <div class="myClass">Hello, World!</div>
</body>
<!-- Bad -->
<body>
    <div style="color: blue;">Hello, World!</div>
</body>

8.2. Avoid Unnecessary Nested Elements

Deeply nested elements can make the DOM larger and more complex, slowing down page rendering. Try to keep your HTML structure as flat as possible.

To avoid making the DOM larger and more complex, you can:

  • Use CSS Flexbox or Grid for layout purposes instead of nested tables or divs.
  • Use CSS combinators to style elements without increasing HTML complexity.

Use Document.querySelector() or Document.querySelectorAll() to directly access deeply nested elements.

<!-- Good -->
<div class="container">
    <div class="item">Item 1</div>
    <div class="item">Item 2</div>
</div>
<!-- Bad -->
<div>
    <div>
        <div>Item 1</div>
    </div>
    <div>
        <div>Item 2</div>
    </div>
</div>

9. Ensure Text Remains Visible During Webfont Load

Webfonts can slow down your site, but you can mitigate this by ensuring text remains visible during webfont load.

9.1. Use Font Display Options Like “Swap” or “Fallback”

The CSS font-display property controls how a font is displayed based on whether and when it is downloaded and ready to use.

The “swap” value tells the browser to use the fallback font to display the text until the custom font has loaded, while the “fallback” value gives the font a short block period and an infinite swap period.

To use font display options like “swap” or “fallback”, you can add the font-display property to your @font-face rule in your CSS. Here’s how you can do it:

@font-face {
  font-family: 'MyFont';
  src: url('/path/to/myfont.woff2') format('woff2'),
       url('/path/to/myfont.woff') format('woff');
  font-display: swap; /* or fallback */
}

This tells the browser to use the fallback font to display the text until the custom font has loaded. If you use “fallback”, the font gets a short block period and an infinite swap period.

9.2. Host Webfonts Locally or on a CDN

Hosting webfonts locally or on a Content Delivery Network (CDN) can speed up load times by reducing the number of HTTP requests, leveraging browser caching, and improving content delivery speed.

To host webfonts locally or on a CDN, you can follow these steps:

  • You can download webfont files from sources like Google Fonts, Font Squirrel, etc.
  • If you’re hosting the webfonts locally, upload the files to your server. If you’re using a CDN, follow the CDN’s instructions to upload the files.
  • Use the @font-face rule in your CSS to point to the location of the font files.
@font-face {
  font-family: 'MyFont';
  src: url('/path/to/myfont.woff2') format('woff2'),
       url('/path/to/myfont.woff') format('woff');
}

This can speed up load times by reducing the number of HTTP requests, leveraging browser caching, and improving content delivery speed.

Join 12,000+ Agencies Loving Our Managed WordPress Hosting!

Say goodbye to the need for an in-house IT team. Opt for Cloudways and experience lightning-fast hosting, expert 24x7x365 support, and the performance your clients expect from your agency

Summary

In conclusion, improving your WordPress site’s First Contentful Paint (FCP) is a multifaceted process that involves both server-side and front-end strategies. Improving server response, using server caching, removing rendering blocks, and enhancing CSS all speed up FCP.

Tools like Lighthouse, Google PageSpeed Insights, and GTmetrix can help diagnose FCP issues and guide your optimization efforts. Remember, a good FCP score is 1.8 seconds or less, which ensures most users perceive your site as fast and responsive.

Share your opinion in the comment section. COMMENT NOW

Share This Article

Inshal Ali

Inshal is a Content Marketer at Cloudways. With background in computer science, skill of content and a whole lot of creativity, he helps business reach the sky and go beyond through content that speaks the language of their customers. Apart from work, you will see him mostly in some online games or on a football field.

×

Get Our Newsletter
Be the first to get the latest updates and tutorials.

Thankyou for Subscribing Us!

×

Webinar: How to Get 100% Scores on Core Web Vitals

Join Joe Williams & Aleksandar Savkovic on 29th of March, 2021.

Do you like what you read?

Get the Latest Updates

Share Your Feedback

Please insert Content

Thank you for your feedback!

Do you like what you read?

Get the Latest Updates

Share Your Feedback

Please insert Content

Thank you for your feedback!

Want to Experience the Cloudways Platform in Its Full Glory?

Take a FREE guided tour of Cloudways and see for yourself how easily you can manage your server & apps on the leading cloud-hosting platform.

Start my tour

CYBER WEEK SAVINGS

  • 0

    Days

  • 0

    Hours

  • 0

    Mints

  • 0

    Sec

GET OFFER

For 4 Months &
40 Free Migrations

For 4 Months &
40 Free Migrations

Upgrade Now