How to Remove Unused CSS in WordPress (The Right Way)

Do you want to remove unused CSS in WordPress so your site will load faster?

Unused CSS is any CSS code added by your WordPress theme or plugins that you don’t really need. Removing this CSS code improves WordPress performance and user experience.

In this article, we’ll show you how to easily remove unused CSS in WordPress without breaking your website.

Removing unused CSS in WordPress

What is Unused CSS in WordPress?

Unused CSS in WordPress is CSS code that loads on your website but isn’t actually needed in order to display the page.

The extra code can make a visitor’s browser take a bit longer to render a page, which creates a bad user experience. The slower loading times can even affect your search rankings, resulting in less traffic to your site.

You can see how unused CSS code is affecting your website by using Google Pagespeed Insights. It will show you a section titled ‘Remove unused CSS’ with details of which CSS files are affecting your loading times.

Unused CSS code issue in Google Pagespeed Insights

Why Is Unused CSS Added in WordPress?

CSS is used to style the appearance of your WordPress website. Your WordPress theme includes CSS, with most of it included in a single style.css file.

In addition to your theme’s CSS, your WordPress plugins will also load their own CSS. For instance, WooCommerce will load CSS to display products, a page builder plugin will add its own CSS to display your custom pages, and a form builder plugin will include CSS to style your forms.

Then, you have your web fonts, icon fonts, and other elements that will need to add their own CSS files as well.

Usually, these files are very small and load quickly. However, if your WordPress site has a lot of them, then the effects can add up and have a noticeable impact on your site speed.

How to Remove Unused CSS in WordPress?

There are a few different ways that you can reduce unused CSS on your WordPress website.

However, it would be quite a difficult task to completely remove all unused CSS in WordPress. Because of the way WordPress works behind the scenes, some unused CSS may be hard to find and remove.

That said, we’ll show you two methods to remove unused CSS, and you can choose the one that works best for you.

Method 1. Remove Unused CSS in WordPress using WP Rocket

This method is easier and is recommended for beginners. It greatly improves the overall delivery of CSS files on your WordPress website, including removing most of the unused CSS.

We think it is the best solution for beginners because it is easier and achieves the main goal of providing a better experience for your users. This means your website loads fast on speed testing tools and also feels fast to your users.

First, you need to install and activate the WP Rocket plugin. For more details, see our step by step guide on how to install a WordPress plugin.

Upon activation, you need to visit the Settings » WP Rocket page and switch to the ‘File Optimization’ tab.

File optimization in WP Rocket

Next, you need to scroll down to the CSS files section. From here, you need to check the box next to the ‘Optimize CSS delivery’ option.

Optimize CSS delivery in WP Rocket

This option generates a CSS file that only contains the CSS code needed to display the visible part of your website. It loads that file first, displays the page to your visitors, and then loads other CSS files using a technology called deferred loading.

By removing this render-blocking CSS, your website becomes viewable to users much more quickly than it would if you had to load all the CSS files before the page is displayed.

After enabling the ‘Optimize CSS delivery’ option, click the Save Changes button and wait for WP Rocket to generate the necessary CSS file for all your posts and pages. It will also automatically clear the cache for your website.

Once finished, you can go ahead and test your website performance again using Google Pagespeed Insights.

Additional File Delivery Tweaks to Boost Performance

WP Rocket also allows you to remove query strings from static files, combine Google Fonts files, and minify HTML. All of these tweaks add tiny improvements to your overall speed, which add up to a faster loading experience for your visitors.

Basic file optimization

You’ll also see options to minify and combine CSS files. These options will reduce HTTP requests and give you an additional speed boost.

However, you’ll need to carefully check your website to make sure that nothing is broken after enabling these settings.

Minify and combine CSS files

Additionally, you can apply the same optimization for JavaScript files on your website. You can minify and combine them to serve as a single file and defer loading for JavaScript files to improve performance.

Optimize JavaScript delivery

For more details, see our step by step tutorial on how to properly setup WP Rocket in WordPress.

Method 2. Remove Unused CSS in WordPress using Asset CleanUp

This method is a little advanced but incredibly powerful and will let you easily remove any unused CSS from any page of your WordPress website.

However, it is a bit complicated and you will need to test your website functionality and appearance thoroughly to make sure nothing is broken.

First, you need to install and activate the Asset Cleanup plugin. For more details, see our step by step guide on how to install a WordPress plugin.

Upon activation, you need to visit the Asset CleanUp » Settings page and switch to the Test Mode tab. From here, you need to turn on the ‘Enable Test Mode’ option.

Enable test mode option

This allows you to try out different settings and test them as an administrator without affecting website visitors.

After that, you need to visit the Asset CleanUp » CSS/JS Manager page. From here, you can unload unwanted CSS and JavaScript files on a page by page basis.

CSS / JS Manager

It will first fetch your homepage and will show you all the CSS and JavaScript files loaded on that page.

You need to scroll down and review the loaded files. If you see a file that you don’t need, then you can unload it for that particular page, post type, or sitewide.

Unloading files

The plugin also allows you to choose specific posts or pages from here, or you can access the same options by editing the post or page as you normally would.

On the post edit screen, you’ll find the Asset CleanUp box just below the post editor.

Asset Cleanup inside post editor

The plugin will automatically fetch and list all the files and assets loaded when a visitor views this page on your website. You can then simply unload the unused CSS or JavaScript files that you don’t need on that page.

Unload files for a particular page

Important: Don’t forget to test your website after removing any unused CSS or JavaScript to make sure that everything is working fine.

Once you are done unloading and removing unused CSS and JavaScript files, you can go to back to the plugin’s settings page and switch off the ‘Test Mode’.

Don’t forget to click on the Update All Settings button to store your changes.

You can now test your website using Google Pagespeed Insights to see the change in the unused CSS notice.

CSS reduced in WordPress

We hope this article helped you learn how to easily remove unused CSS in WordPress. You may also want to follow our complete guide on how much does it cost to build a website, and check out our list of the best managed WordPress hosting.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

The post How to Remove Unused CSS in WordPress (The Right Way) appeared first on WPBeginner.

How to Properly Run a Website Speed Test (8 Best Tools)

Do you want to run a website speed test? Most beginners don’t know where to begin and what to look for in their website speed test.

There are a ton of online website speed test tools that you can use. However, all of them present results in a way that it becomes incomprehensible for non-tech savvy users.

In this article, we’ll show you how to properly run a website speed test and the best tools to run your speed tests.

Running a website speed test with proper tools

Best Tools to Run a Website Speed Test

There are a lot of free and paid website speed test and performance monitoring tools that you can use. Each one of them has some really cool features that distinguish them.

You don’t need to just test your website with one tool. You can use multiple tools and run multiple tests to be thorough.

However, we recommend users to just use these tools to improve your website performance. Trying to achieve a perfect grade or score on these tools is often extremely difficult and quite impossible in most cases for real-world functioning websites.

Your goal should be to improve your page load speed for your users, so they can enjoy a faster and consistent user experience on your website.

Having said that, let’s take a look at the best tools to run a website speed test.

1. IsItWP Website Speed Test Tool

IsItWP Website Speed Test Tool

IsItWP’s free website speed test tool is the most beginner-friendly website speed testing tool. It allows you to quickly check your website performance, run multiple tests, and drill down the results to find out what’s slowing down your website.

You also get improvement suggestions neatly organized. You can click on each category to see the steps you can take to troubleshoot performance issues. The website also offers server uptime monitoring and other useful tools for website owners.

2. Pingdom

Pingdom

Pingdom is one of the most popular website performance monitoring tool. It is easy to use and allows you to select different geographical locations to run a test which is really handy.

The results are presented with an easy to understand overview, which is followed by the detailed report. You get performance improvement suggestions at the top and individual resources as they loaded.

3. Google Pagespeed Insights

Google Pagespeed insights

Google Pagespeed Insights is a website performance monitoring tool created by Google. It gives you website performance reports for both mobile and desktop views. You can switch between these reports and find some issues that are common among both reports and some that Google recommends being fixed in the mobile view.

You also get detailed recommendations for each issue, which is helpful for developers. However, the tool itself is a bit intimidating for beginners and non-developer users.

4. GTmetrix

GTmetrix

GTmetrix is another powerful website speed testing tool. It allows you to test your website using popular tools like pagespeed and YSlow. You can change geographic location and browser by creating an account.

It shows detailed reports with a brief summary of the results. You can switch between the two tools and view recommendations. Clicking on each recommendation will provide you with more details.

5. WebPageTest

WebPageTest

WebPageTest tool is another free online speed test tool that you can use. It is a bit more advanced than some other tools on our list. However, it does allow you to choose a browser and geographic location for your tests.

By default, it runs the test 3 times to get your website speed test results. It shows a detailed view of each result which you can click to expand and view the full report.

6. Load Impact

Load Impact

Load Impact is slightly different than other website speed test tools on this list. It allows you to see how your website slows down when more visitors arrive at the same time.

It is a paid service with a limited free test, which allows you to send 25 virtual users within 3 minutes. The paid version allows you to test larger traffic loads. This helps you test website speed test, while also testing how increased traffic affects your website.

7. Uptrends

Uptrends

Uptrends is another free website speed test tool. It allows you to select a geographic region, browser, and switch between mobile and desktop tests.

Results are simple and easy to understand as it also shows your Google pagespeed score in the summary. You can scroll down for details and comb through your resources to understand the performance issues.

8. Byte Check

Byte Check

Byte Check is another free website response time checker. It is made specifically to check TTFB (time to first byte) measurement, which is the time your website takes to deliver the first byte of data back to user’s browser. It is a highly effective way to test how faster your WordPress hosting server is.

You can use any of the tools mentioned above to check your website speed and performance. However, simply running the tests alone would not help you much.

You’ll need to learn how to run these tests properly and use the data to optimize your website.

How to Properly Run a Website Speed Test

Running website speed tests is not guaranteed to tell you exactly how your website performs.

You see, the internet is like a highway. Sometimes there is more traffic or congestion which may slow you down. Other times, everything is clear and you can run through it much quicker.

There are several other factors involved which would affect the quality and accuracy of your results. It is important to run these tests thoroughly before you start analyzing the data.

Let’s see how to properly run a website speed test to get more accurate results.

1. Run Multiple Tests

There are multiple factors that can affect your test. Even though most website speed test tools run over the cloud at the fastest internet speeds, each test would show you slightly different results.

The most important difference you will notice is the time it took to download the complete webpage. We recommend running at least 3 tests to get a more accurate picture.

Run multiple tests

You can then take out an average result and use it to decide whether or not your website needs improvement.

2. Test from Different Geographic Locations

If most of your customers visit your website from Asia, then testing your website speed using servers located in the USA would not be ideal.

The test results will show you a different user experience than what your actual users are feeling when they visit your website.

Geo locations

This is why you need to use Google Analytics to see where your users are coming from. After that, use that information to select a geographic region for your tests.

For example, if you learned that most of your website users are coming from Europe, then choosing a test server in Germany will give you the closest results.

If your website visitors are from all over the world, then you can run multiple tests to find out how your website performance varies for different regions.

3. Make Sure Your Website Caching is Turned On

Make sure that your website caching is turned on before running the tests. This would allow you to test website caching and how effective it is in improving the performance.

Now the problem is that some caching solutions only store cache when a user requests the page. This means cache takes some time to build and may expire by the time you run the tests.

This is why we recommend WP Rocket. It is the best WordPress caching plugin that lets you setup your WordPress cache with a few clicks and without learning technical stuff.

The best part is that it proactively builds your website cache, which significantly improves your website performance. See our guide on how to set up WordPress cache using WP Rocket for more details.

4. Check the Performance of Your Website Firewall / CDN Service

While WordPress caching plugins can do a lot, they definitely have their limitations. For example, it cannot block DDOS attacks and brute force attempts. It also does nothing against spambots which means your server resources get wasted a lot.

This is where you need Sucuri. It is the best WordPress firewall plugin which improves your server performance by blocking malicious requests.

Now, normally all your website files are served from the same server. You can improve this by adding a CDN service to your website. We recommend using MaxCDN (by StackPath), which is the best CDN solution for beginners.

A CDN service allows you to serve static website files like images, stylesheets, and scripts through a network of servers spread around the globe. This reduces the server load on your website, makes it load faster, and improves user experience for all your users.

Turning on your CDN service and the firewall will improve your test results significantly.

Understanding Website Speed Test Results

The most important parameter that you should look into is the time it takes your website to load.

Page load time

This is the parameter that affects your users the most. If your website takes longer to load, then users may decide to hit the back button, have a bad impression of your brand, and consider your website of low quality.

If your website is taking longer than 2 seconds to load, then look at the drill-down reports. Find out which resources are taking longer to load.

Usually, these are images, stylesheets, scripts loading from third-party websites, video embeds, and so on. You would want to make sure that those images are served from the cache or your CDN service.

Looking at individual resources

You would also want to pay attention to how long your server takes to respond to each request and how much time time it takes to deliver the first byte.

You would also want to make sure that browser compression (also called gzip compression) is working. This reduces the filesizes between your server and user’s browser by compressing them.

If your page has lots of images and videos, then you may want to consider deferred loading techniques also called lazy loading. This allows content to be loaded when a user scrolls down and only loads the content that is visible on the user’s screen.

As always, you definitely want to make sure your images are optimized for web by using an image compression tool.

The second important parameter you would want to test is the TTFB (time to first byte). If your web server is continuously showing a slower time to the first byte, then you may need to talk with your web hosting company.

All top WordPress hosting companies like Bluehost, SiteGround, and WP Engine have their own caching solutions. Turning on your host’s caching solution may significantly improve TTFB results.

We hope this article helped you learn how to properly run a website speed test and the best tools to run your tests. You may also want to follow our step by step WordPress speed and performance guide to boost your website speed.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

The post How to Properly Run a Website Speed Test (8 Best Tools) appeared first on WPBeginner.

How to Improve Google Pagespeed User Interaction Metrics in WordPress

User Interaction is one of the critical aspects you need to concentrate on if you want to deliver a welcoming user experience. Unfortunately, you can’t sit down in their place and see your site from your visitors’ point-of-view, so you need a way to figure out how your site responds to input.

Enter Google PageSpeed Insights. There are 3 metrics in Google PageSpeed Insights that will help you understand the user interaction experience so you can improve, Time to Interactive, Max First Input Delay, and First CPU idle.

In this post, we’re going to cover the metrics Google PageSpeed Insights uses to measure user interaction. I’m going to show you how to improve Time to Interactive, Max First Input Delay, and First CPU idle so you can deliver the best user experience for your visitors.

What is Interactive Design?

Tell me if this has ever happened to you. You go to a site and as the content is loading, you click on something, but nothing happens. So you click on it again and again and then when the page finally responds, you end up on some random advertisement landing page or somewhere else you didn’t want to be.

That my friends is a negative user interaction.

Interactive design focuses on allowing the user to achieve their goals, whether that’s purchasing a product or signing up for your newsletter, as easily as possible.

There are many dimensions to interactive design. What we’re most concerned with in this article is feedback and how long it takes to deliver, since it helps your visitors assess if their actions are effective.

If the response time between an action (like a click) and the response takes too long, your visitors will lose faith in your site and probably turn to your competitors.

To deliver a positive user interaction as your site loads, we need to focus on several metrics to give us a well-rounded idea of what the user is experiencing. Let’s look at what those are now.

Measuring User Interaction

Google PageSpeed Insights uses Lighthouse to analyze the performance of a web page for both mobile and desktop devices.

Screenshot of Google PageSpeed Insights Results Page
For this site the user interaction metrics are great, but the site still needs some work to improve the other metrics

Lighthouse takes a user-centric approach and measures the following:

  • First Contentful Paint
  • First Meaningful Paint
  • Speed Index
  • First CPU Idle
  • Time to Interactive
  • Estimated Input Latency

Lighthouse collects lab data within a controlled environment with a predefined device and network settings and then assigns each metric a score. Scores in the ideal range are shown in green, while low scores are shown in red. Yellow scores fall in the average range.

These six metrics each tell you something different about what your user experiences as they’re waiting for your site to load and together they form a more complete picture.

First CPU Idle, Time to Interactive, and Estimated Input Latency are the three that will tell us about user interaction. For more about First Contentful Paint and First Meaningful Paint, and the Speed Index, check out those posts.

What is Lighthouse Time to Interactive?

The Time to Interactive metric, or TTI, measures how long it takes before the user can reliably interact with the content on the page by doing things like clicking links or entering text into input fields.

A TTI score of less than 100ms is ideal because when your visitor takes an action, the response feels almost instantaneous. Any longer than that and the user will perceive the lag as something wrong with your site.

While the ideal Time to Interactive in WordPress should be under 100ms, you do have some flexibility. On a landing page with a web form, the Time to Interactive benchmark would be very important. On a blog page, with only a couple of links, TTI would be less important than content visibility. Each site has different priorities, so you should only sacrifice content visibility for interactivity if it makes sense.

How is Time to Interactive Measured?

Time to Interactive is tricky to measure because there isn’t an exact and clearly defined point when the page is ready for interaction.

Think of it like measuring how long it takes to make stovetop popcorn. It’s impossible to say exactly how long it will take because you can’t see inside the pot and don’t know how many kernels still need to pop. So to make popcorn without burning it, you need to listen. When there’s a long enough delay of a few seconds between pops, you can safely assume that the popcorn is about ready.

Measuring Time to Interactive is a similar process. Lighthouse observes the main thread and network activity to figure out what is taking place. It is looking for a big enough time window on the browsing context event loop and a 5-second sub-window of network quiet where the probability of long tasks or heavy processing taking place are low.

It knows when to pay attention by looking for the First Contentful Paint and detecting when event handlers are registered for most visible page elements.

How to Improve Time to Interactive

To improve your TTI score, focus on improving your site’s JavaScript code. Downloading, parsing and executing JavaScript consumes more CPU than all other browser activities combined.

While mobile devices and computers now have more CPU, the amount of JavaScript on webpages has ballooned, increasing 3 fold in the last 6 years.

JavaScript operates in a single-threaded environment which forms a bottleneck when one process takes too long to perform. When one process blocks the single thread, everything else has to wait including other processes and user feedback.

This is even worse on mobile. Tasks can take 3-5x longer and the high CPU load drains batteries. Not to mention that the site will appear janky so it doesn’t make for the best user experience.

Tasks that take longer than 50ms are considered long tasks. To improve your TTI score, remove unnecessary JavaScript or defer it until the page is finished loading. You should also break up large files to prevent a bottleneck.

What is First Input Delay?

The Google First Input Delay metric measures how long it takes for the browser to respond to the user’s input, such as clicking a button. An ideal First Input Delay of 10ms is ideal.

While Time to Interactive, can be measured in a lab setting, First Input Delay or FID, requires users to be calculated accurately. A Google PageSpeed Insights test does include a metric for Max Potential First Input Delay, but an analytics tool, such as Google Analytics will give you more accurate results.

If you are collecting First Input Delay data from your analytics tool, then you’re capturing real user pain. If the wait time is long, then you know your visitors are probably frustrated because they have to wait every time they interact with the page. If that wait time is especially long and your bounce rate is high, then guess what? You’re losing visitors because of a poor site experience. Ouch.

What counts as a first input?

Let’s define the first input delay meaning because it doesn’t include all user interactions.

FID measures actions like clicks, key presses and entering text in fields. It does not include scrolling or zooming since they can be run on a separate thread by the browser.

This is why if your site doesn’t have any actions the user can take, other than scrolling or zooming, you won’t have a First Input Delay metric to deliver.

How to Fix First Input Delay

TTI and FID are closely related, so if you work on delivering your JavaScript more efficiently to improve your Time to Interactive, it will also improve First Input Delay.

If the browser’s main thread is busy then it won’t be able to respond to user input so you should work to split up long tasks or not run them on the main thread. This will keep the main thread open.

Third party ads and social widgets have a reputation for being greedy when it comes to consuming resources on their host pages so you should aim to include the fewest third-party iframes possible.

One approach to improve First Input Delay is by deferring non-critical tasks until they’re called for. This method is called “Idle Until Urgent” if you’d like to learn more about how to use it.

What is First CPU Idle in Lighthouse?

The First CPU Idle in Lighthouse measures when a page is minimally interactive and most but not all of the elements are ready for interaction. If you do interact with elements on the page, there may be a delay, but the page will respond.

First CPU Idle in PageSpeed Insights was originally called Time to First Interactive. It indicates when there is the first span of 5 seconds in the main thread when tasks so not take longer than 50ms after the First Contentful Paint.

The First CPU Idle is similar to Time to Interactive because both listen for JavaScript event handlers in order to return an accurate measurement, but First CPU Idle does not require the browser to respond to user input in less than 50 milliseconds.

A value of 2-4 seconds for the First CPU Idle in WordPress is about average.

How to Improve First CPU Idle?

An easy First CPU Idle fix is to minimize the number of resources that need to be executed before a page can load and reduce the size of the remaining resources.

These are the same strategies to improve TTI and FID, optimize the critical rendering path and optimize content efficiency.

User Experience Interaction Guidelines

Lighthouse does not assess your whole site. It audits one page at a time, so to understand how your site performs, you need to test a variety of page types on your site. Test a blog page, a product page, checkout, etc. Pay special attention to important conversion pages, like your landing pages and shopping cart.

Lighthouse evaluates six test metrics, but it doesn’t weigh them all the same when coming up with an overall score. Each is weighted differently.

The metric with the most weight is Time to Interactive because it has a greater impact on the page’s overall performance. This is followed by Speed Index, First Contentful Paint, First CPU Idle and First Meaningful Paint, in that order.

How to Improve Your Score

You may have noticed a pattern in the suggestions to improve Time to Interactive, First CPU Idle, and First Input Delay. Since these three metrics are closely related, you take a holistic approach to improving them. By improving your interactions for your users, you’ll improve all three.

Here are actions you can take to improve your scores:

  • Optimize the Critical Rendering Path
    • Minimize or eliminate critical resources in the main thread.
    • Defer their download or load them asynchronously if you can.
    • Optimize the size of assets by compressing or minifying to reduce the download time.
    • Download all critical assets as soon as possible to shorten the critical path length.
  • Lazy Load Your Images – If an image is below the fold, wait to load it until you need to. Prioritize loading the page first, then when you have idle time in the main thread, you can load the image once the visitor scrolls down the page.
  • Enable browser caching – Caching files dramatically cuts down the loading time for additional pages by storing assets in a cache for faster retrieval. With HTTP caching, the browser stores a copy of assets downloaded via HTTP by the user in its cache so it will be able to retrieve them without making an additional trip to the server. We recently compared Hummingbird to other popular caching plugins and Hummingbird out optimized all of them.
  • Use a CDN – Intermediary caches such as content delivery networks can help you serve assets faster from a closer data center to the user.
  • Use JavaScript Wisely
    • Remove unnecessary JavaScript files and unused portions within files.
    • Split up large JavaScript files.
    • Defer loading of low-priority JavaScript files.
    • Minify and compress JavaScript files

Smush Pro has a CDN that can help you lazy load your images. Hummingbird can assist with enabling browser caching. You can get a free 30 trial for both right here to improve your Google PageSpeed Insights score.

How to Use Googles Speed Index to Improve WordPress Performance

Does your site load content steadily like the tortoise, or wait until the race is almost over before it kicks into high gear, like the hare? In the race to provide the best user experience, steady is best. That’s why Google PageSpeed Insights measures your WordPress Speed Index to determine how your site content loads over time.

The Speed Index can tell you if you’re providing enough visual feedback as your site loads. It’s an important metric for understanding what your visitors are experiencing.

In this post, I’ll show you how Speed Index is calculated, how to run a WordPress Speed Index test in Chrome and tell you what you should be aiming for. Then, we’ll cover some techniques you can use to improve your Speed Index.

What is Speed Index in Lighthouse?

Lighthouse is the open source tool Google PageSpeed Insights utilizes to analyze a webpage.

Lighthouse grades your webpage on the following criteria:

  • Is it being served from a secure location?
  • Is it accessible for all users?
  • Are visitors who are on unreliable network connection (like those on mobile) able to reach it?
  • Do users perceive your site as fast?

It’s in Google’s best interest to prioritize high-quality sites in search rankings in order to provide the best user experience. Speed Index is one metric used to assess how fast your site feels for users, in a way that captures how your site actually performs in real life.

How Google Speed Index is Measured

Here’s how Speed Index is defined in the Lighthouse documentation:

Speed Index is a page load performance metric that shows you how quickly the contents of a page are visibly populated.

Could that be any more vague? That doesn’t tell us a whole lot about how this information is captured so we could improve our scores, so I had to go to the source.

WebPagetest.org, in partnership with Google, introduced the Speed Index metric to their test in April 2012 and they fully break down how the Speed Index calculations work. Lighthouse uses a node module called Speedline whose current implementation is based on the Visual Progress from Video Capture method that was introduced by WebPagetest.org.

Even though it’s measured in milliseconds, Speed Index isn’t measured with a stopwatch like first paint; it’s calculated using a cumulative distribution function of a log-normal distribution. I know, huh?

Here’s how it works, when you perform a Google PageSpeed Insights audit, Lighthouse records a video of your web page loading. It only includes everything above the fold, which is why Speed Index will vary based on the viewport you’ve set for your test.

The video is how Lighthouse is able to “see” your site. It then breaks down the whole little video into frames. There are 10 frames per second. So if your site loads in 3 seconds, then there will be 30 frames, showing your site’s progress.

Screenshot of frames captured in Lighthouse used to calculate speed index
Here’s a simple version of what this looks like.

Lighthouse compares each frame to the final frame to determine how complete it is. Is it 5% loaded? 10%? 20%? 30%? etc.

Then it plots the completeness of your page on the y-axis and elapsed time on the x-axis so it can determine the average. The overall score is the sum of the individual intervals. The graph for the frames above would look something like this, with the blue area representing the Speed Index.

Graph of the speed index for the images above
The area in blue above the line is the Speed Index

There is also the Visual Progress from Paint Events method for determining Speed Index WebKit browsers, that does not require capturing video and instead relies on collecting the timeline data such as paint events and other useful events. This isn’t supported on all browsers so it varies and isn’t as widely used so we won’t get into it in detail here.

How to Get Speed Index from Google Chrome

Now that you know how the Speed Index is being calculated, you should take the time to run your most popular pages through Google PageSpeed Insights.

If you’d like to do this directly in Google Chrome, hit Ctrl+Shift+i or right-click in the browser window and select Inspect

Go to the Audits tab. From there you’ll be able to select what kind of audit you want to run a test for mobile or desktop. Select the Performance checkbox to get the Speed Index, then push the blue Run Audits button to begin.

Screenshot of Chrome Developer Tools Audit Tab
You don’t need to go to the Google PageSpeed Insights page, this will give you the same results since they both utilize Lighthouse

What Speed Index Score Should You Be Aiming for in Google?

Alright, so you’ve run your tests, but what’s a good score?

According to Paul Irish, who works on the Google Chrome team, the ideal Speed Index is less than 1000ms, which is equivalent to 1 second.

In order to improve, you need to get your Speed Index score as low as possible.

In March 2018, the NCC Group analyzed the home pages of 50 retailers in the UK and found that the average Speed Index score was between 3500-8000 ms. Dareboost did a similar analysis on European publishers and less than 5% of sites had a Speed Index score that was less than 1000 ms.

With that said, reducing your Speed Index to less than a second isn’t always feasible. In these cases, the best approach is simply to outperform your competitors.

We wrote a guide on how to get a 100 in Google PageSpeed Insights.

How to Improve WordPress Speed Index

Improving the Speed Index is a matter of improving the actual performance as well as the perceived performance of your site.

You can optimize performance by:

  • Optimizing Content Efficiency
  • Optimizing the Critical Rendering Path

To improve perception, there’s a wide variety of progressive loading techniques you can use.

If It Doesn’t Spark Conversions, Get Rid of It

The most effective way to improve both performance and perception is by eliminating unnecessary site assets. Your site gets cluttered too! Images, JavaScript files, CSS, etc. that don’t add a lot of value or are no longer being used, should be cut loose. You should repeat this process periodically, especially when you add new elements to your site.

Also, measure the value that new components add to your site. If that new resource-intensive image slider, video background or third font isn’t converting visitors then get rid of it.

Need help convincing your clients to omit page elements? Run this mobile PageSpeed test. On the results page, scroll down to the bottom, and open the Evaluate the impact of a faster site section. The calculator will help you show how increasing site speed can improve annual revenue.

Screenshot of revenue calculator that shows how much you can earn by improving site speed
I mean, that number makes a pretty compelling argument

Use predefined heights and placeholders

Loading a framework for the rest of your content gives your user the impression that the site is loading in an organized and intentional way.

To create a framework, create a space for elements of your site that take longer to load, such as images and videos. You can do this by setting pre-defined heights for your containing elements in CSS, or loading placeholder images or icons.

Not only does this let the visitor know that more content is coming, so they can decide if they’d like to wait, but this prevents the site contents from shifting erratically as more elements fall into place.

Optimize Your Images

Images are one of the worst offenders when it comes to adding unnecessary weight to your webpages. The best way to cut down on page weight is by eliminating unnecessary images, then optimize what’s left by doing the following:

A quick and easy way to optimize your images is by using a plugin like Smush Pro. Try Smush Pro free for 30 days.

Optimize Stylesheets, Scripts, and Fonts

When a browser is building your page, when it comes across a CSS file or a JavaScript file, it needs to execute those files before it continues to render the page. That’s why CSS and JavaScript files that reside in the head of your page are referred to as render-blocking resources. Since they’re blocking the rendering of your content, you must optimize them so they take the least time possible to load.

Fonts also add a lot of weight to webpages, since each font is an additional resource that the browser needs to spend time downloading. Some fonts may block the rendering of the page. By default, fonts don’t begin downloading until the DOM and CSSOM are constructed, which can result in delayed text rendering.

Here’s how to optimize the additional assets needed to build your page:

  1. As I said earlier, the best way to optimize something is to flat-out delete it. Cut the weight and move on. For webfonts, reduce the number of font variants, so instead of three different bold weights, maybe use one or none if you can get by without it.
  2. Don’t load one huge JavaScript file. Use code splitting to break up your file and load the scripts that aren’t critical to the rendering of the DOM to the bottom of your page.
  3. Compress and minify your files so they take less time to download.

Want an easy all-in-one solution that was designed to help you improve your Google PageSpeed Insights score? Hummingbird can help.

Optimize the Critical Rendering Path

The critical rendering path refers to all of the assets the browser needs to render to respond to the visitor’s current request. You want to prioritize the assets above the fold that are most important right now and load them as quickly as possible.

This requires that you analyze the components in the critical rendering path and look for ways to improve, consolidate and organize the whole load. Think of it like running errands. If you map out your route ahead of time, you can get more done in less time than if you were zipping all over town doing things as you thought of them. The haphazard way will burn through resources running back and forth.

Here’s how Google recommends you optimize the critical rendering path:

  • Analyze and characterize the elements in your critical path.
  • Minimize number of critical resources. If you can, eliminate them. For the rest, defer their download or load them asynchronously.
  • Optimize the size of assets by compressing or minifying to reduce the download time.
  • Download all critical assets as soon as possible to shorten the critical path length.

 Utilize Caching

Once you have your new optimized page done, then you’re ready to utilize page caching.

Caching is a reliable way to improve site speed for your visitors by storing assets in a cache for faster retrieval. There are several kinds of caches.

With HTTP caching, the browser stores a copy of assets downloaded via HTTP by the user in its cache so it will be able to retrieve them without making an additional trip to the server. This dramatically improves performance for repeat visitors when done properly.

We recently compared Hummingbird to other popular caching plugins and Hummingbird out optimized all of them.

You should also use intermediary caches such as content delivery networks, or CDNs to serve assets from a closer data center to the user.

Speed Index Limitations

While Speed Index is better than timeline based metrics for helping us measure user experience, it’s not perfect.

If your site has movement, then the Speed Index won’t be accurate.

Here are some moving elements that might affect your score:

  • Videos that autoplay
  • Carousels
  • GIFs

Additionally, if you do not create placeholders for the elements on your site and the contents of your page shift as the content loads, this layout instability will also return an inaccurate Speed Index.

Still, Speed Index is one of the best tools we have at the moment, so even with these limitations, it’s still useful. Used in combination with the other metrics provided in Google PageSpeed Insights, Speed Index helps you get a complete overview of what you need to work on to improve your site for your visitors.

How to Improve Speed Index with a WordPress Plugin

WordPress performance plugins have come a long way. You no longer need to use a set of different plugins to improve every aspect of your site’s performance. You can use an all-in-one plugin like Hummingbird, which was designed to help you pass all the audits in Google PageSpeed Insights.

We designed Hummingbird not only to help you increase your Speed Index score positively but to truly help you deliver a better user experience for your peeps. Combine Hummingbird with Smush to get the most of the WordPress speed optimization service WPMU DEV offers.

Hummingbird 2.0: Mobile Scans and Advanced Speed Tests… Vroom!

Hummingbird performance tests, reports, and recommendations just got a major upgrade but to get access to the all new lean-mean-humming-machine…you need to update!

In November, Google made much needed changes to PageSpeed Insights. Speed is now being calculated based on actual user experience and a site performance analysis. Thanks to this new Lighthouse integration, Hummingbird is able to see where your page is slowing in the loading process and offer better solutions for fixing performance issues.

No more shooting in the dark! No more PTSD (Performance Test Stress Disorder). Now you can find speed bottlenecks, put a solution in place that actually makes things faster for your visitors, and move on. Bing bang bong!

The upgraded performance test along with +25 other upgrades and improvements are available now. Get your copy of Hummingbird on WordPress.org or start your 30-day free trial to get Hummingbird Pro and the entire WPMU DEV performance suite.

Now that you’re all set up, Take a look at the highlight features in version 2.0, including advanced Multisite integration, a new reports module with Lighthouse recommendations, and performance report customizations.

Are you an active Hummingbird user? Upgrade to 2.0. Not only is it better, Hummingbird 2.0+ ensures compatibility with the new Google PageSpeed Insights moving forward. Enjoy. You’re welcome. No…really. It’s our pleasure!

Hummingbird Google PageSpeed Lighthouse integration
Hummingbird has new recommendations based on actual site performance.

New score metrics include:

  • Speed Index
  • First Meaningful Paint
  • First Contentful Paint
  • Time to Interactive
  • First CPU Idle

What’s Paint Got to do With It?

We recently took an in depth look at the new speed results and if you’re serious about site performance, become well acquainted with the new metrics. If CliffNotes are your thing, basically the new index is calculated based on how quickly content is seen, delivered, and able to be interacted with.

In short, Hummingbird 2.0 uses these new metrics to make your site load blazing fast.

Make it Mobile First

Site performance has many facets. You can score a perfect 100 on Desktop performance and have a horrific mobile experience. NOT ANYMORE! Why? ‘Cause Hummingbird 2.0 lets you choose between mobile and desktop scores.

Activate mobile speed tests from Hummingbird
Hummingbird lets you view and send both Desktop and Mobile reports.

Working on client sites where you want to exclude certain elements of your report? Hummingbird lets you hide score metrics, audit information, and add historic field data to both the dashboard and The Hub. Select what information is relevant based on who has access.

And now Reports can be configured to display both Desktop and Mobile speed results.

Subsite and Network Admin Upgrade

Hey, Multisite friends! This one’s for you. Hummingbird is an excellent performance tool for both WordPress and Multisite. Today she boasts some fancy new Multisite specific tools. Give or limit access to the Asset Optimization Module for subsite users.

Hummingbird Asset Optimization tools for Multisite subsites
Hummingbird gets special Multisite integration for Asset Optimization.

Set access based on role, enable or disable subsite access to the CDN, and troubleshoot with the subsite debug log.

Give All Your Sites Superhero Speed

With advanced performance tests, one-click fixes, recommendations, a powerful cache suite, reporting tools, Multisite integration, and a bunch more, Hummingbird has quickly become a power tool for getting top performance out of WordPress sites. We’re not just saying that, we tested her. See how she stacks up against the others.

But you don’t need me to tell you. We think the best way to fall in love with Hummingbird is to experience all her tools for yourself. That’s why we’ve set you up with a 30-day free membership.

Our WordPress super team is so dang impressive we sound like a bunch of braggers when we talk about them. I don’t want you to feel like we’re over selling you. So we made Hummingbird free. Free on WordPress.org or get started with a WPMU DEV membership and try Hummingbird Pro 2.0, Smush image optimization, Defender security, The Hub dashboard manager, backups, 24/7 live chat support, our marketing power tools, on unlimited sites free for 30-days. I know you’ll be impressed.

Enjoy!

How to Improve First Contentful and Meaningful Paint

You’re not optimizing your site to please a stopwatch. You’re optimizing your site for real people. So how can you determine if you’re achieving your goal?

You need to include metrics such as First Contentful Paint and First Meaningful Paint in your performance assessment in order to measure how your site is performing from your user’s perspective. Both will tell you more about how your site is behaving in the wild so you can optimize the things that will really improve your user’s experience.

In this post, we’re going to focus specifically on how to reduce the amount of time it takes to load content on your WordPress site so you can shorten the amount of time to the First Contentful Paint and First Meaningful Paint and improve your Google PageSpeed Insights score in the process.

What is First Content Paint (FCP)?

First Content Paint, or FCP, is a performance metric that measures how much time has elapsed before the browser begins to display the first elements of the site.

Usually, the first content paint elements in WordPress are header elements, so the visitor will first see the site logo or the navigational menu.

Screenshot of WPMU DEV blog page half loaded
Here’s an example of the First Contentful Paint usually looks like. We’re still waiting for the content to show up.

The First Content Paint is important because it provides the visitor with feedback that their request is in the works. Have you ever clicked on a link or a button and then clicked it a couple more times because nothing happened? The FCP’s job is to communicate “we heard you and we’re working on it.” This assures the reader that they can expect your site to function correctly and provide content.

What is the First Meaningful Paint meaning?

First Meaningful Paint is when the good stuff actually loads. When the content the user is looking for appears on the page, this is referred to as the first meaningful paint.

Screenshot of WPMU DEV Blog page fully loaded
An example of what the First Meaningful Paint looks like, the hero image and intro text has loaded so I can start reading
Screenshot of WPMU DEV blog images haven't finished loading
But if I scroll down right away to show you, you can see that page hasn’t finished loading, the images are still missing. But who cares? The user will probably not scroll down so fast, they’ll start to read through your content while the rest of the page finishes loading.

Visitors come to your site for content, not to see the logo and navigation menu, so the content holds more value for the visitor. The first meaningful paint is one of the most important metrics for evaluating how long your visitor is waiting to receive the information they visited your site for. The first meaningful paint also includes the time it takes to load web fonts since they’re needed to render your content.

The most valuable content elements on your web page are known as hero elements. This varies from site-to-site, but it isn’t hard to determine what the most valuable part of a page is.

For video pages on YouTube, the most important element is the video. On social networks, the first posts in the timeline that are above the fold are the most important. For blogs, the body of the blog post and the featured image (if it is featured above the fold with the blog content) are the most important because this is what the visitor sees first.

Other content, such as images, can be deferred until the visitor needs them.

Using Google PageSpeed Insights to Find the First Content Paint and First Meaningful Paint

Both First Contentful Paint and First Meaningful Paint are known as user-centric performance metrics. Google rewards sites that deliver a better user experience with higher search rankings. Since Google wants to encourage site owners to optimize their sites for users, FCP and FMP are two metrics that are measured in Google PageSpeed Insights.

Screenshot of Lab Data in Google PageSpeed Insights
You can also see a timeline of what your site looks as it loads. Can you tell which is the first contentful and meaningful paint?

Since November 2018, Google PageSpeed Insights has started using an open source tool called Lighthouse to simulate how your site loads for visitors. Lighthouse returns 6 metrics in the Lab Data section, that paint a rich picture of your site’s performance:

  • First Contentful Paint
  • Speed Index
  • Time to Interactive
  • First Meaningful Paint
  • First CPU Idle
  • Estimated Input Latency

First Content Paint and the First Meaningful Paint are time-based metrics that are measured in seconds. To achieve a favorable score in the eyes of Google, you want both the FMP and the FCP to be less than a second.

5 Recommendations to Reduce Paint Times for Your WordPress Site and Improve Your PageSpeed Insights Score

When you run Google PageSpeed Insights, Google provides you with tailored suggestions on how you can fix your site. Running a test is the best way to see how your site falling short.

The following five suggestions are straight from Google for all sites on how to improve first meaningful paint and how to improve first contentful paint.

Our goal with the first four recommendations is to improve First Contentful Paint by speeding up the time it takes to download resources and remove obstacles that block the browser from registering DOM content. The last suggestion is to improve the First Meaningful Paint.

We’re about to get into some techy details, but if you want a simple solution, Hummingbird can help. Try Hummingbird Pro free for 30-days and see what a difference it makes for your site. Version 2.0 is now available to our members with an all new scanner that includes Lighthouse recommendations.

Contentful Paint Recommendations in Hummingbird
Contentful Paint, Meaningful Paint, and one-click fixes now included in Hummingbird Pro.

And for our WordPress.org Hummingbird free users you can expect to see the new scanner sometime next week… or upgrade to pro and get it now ;)

1. “Minimize the number of render-blocking external stylesheets and scripts upon which the page depends”

What is render blocking? When a visitor is loading a webpage, anything that is getting in the way of rendering the DOM is referred to as render blocking. They’re code obstacles that the browser has to process first before it can do anything else.

Sometimes they’re important. Your CSS files, for instance, are render blocking, but they’re critical.

Other times, the render blocking resource can wait. This is why you should move JavaScript files from the header of your webpage if they’re not needed to render the DOM. Load them after the DOM to improve user experience.

If you can, the best way to optimize page speed is to eliminate render-blocking resources altogether. If they don’t spark joy, then byeeeee….

2. “Use HTTP Caching to speed up repeat visits”

Caching is a reliable way to improve site speed for your visitors by storing assets in a cache for faster retrieval. There are several kinds of caches.

With HTTP caching, the browser stores a copy of assets downloaded via HTTP by the user in its cache, so it will be able to retrieve them without making an additional trip to the server. This dramatically improves performance for repeat visitors when done properly.

We recently compared Hummingbird to other popular caching plugins and Hummingbird out optimized all of them.

3. “Minify and compress text-based assets to speed up their download time”

Your webpages consist of text-based HTML, CSS and JavaScript files. If you can’t eliminate a file because it is essential, then you need to reduce the file size as much as possible.

There are two ways to do this:

Minify your files
When you minify your text files, you remove all extraneous characters and spaces, creating a compacted file that is much more difficult for humans to read, but much smaller. The browser doesn’t mind the lack of readability and will be able to download the file much more quickly.

Compress your files
Compressing your files is similar to the process of compressing your images. During the compression process, the compressor detects patterns and duplication in the text file and encodes them much more efficiently.

Both minifying and compressing your text files removes extra bytes that don’t affect your webpage negatively but reduces paint times.

4. “Do less JavaScript work on page load”

JavaScript is one of the worst offenders when it comes to slowing down your site. For one, JavaScript files take more resources to process when compared to other assets. Images, for instance, must be decoded, but JavaScript must be parsed, compiled, and then finally executed, taking up lots of valuable time.

It also doesn’t help when JavaScript code is rolled together into one huge file. I know that feels counterintuitive, but creating one big file doesn’t help performance one bit.

You’re much better off splitting up your code into bite-sized chunks with a process known as code-splitting. Then you can move the chunks that aren’t critical out of the head of your site, reducing the first paint time.

Another way to minimize your JavaScript files is to prune out code that is no longer being used. This process is known as tree shaking. As your site matures, you add in snippets of code, but not all of it is used in the long term. You should periodically go through your JavaScript code and remove what you don’t need.

5. “Optimizing the Critical Rendering Path to achieve a faster First Meaningful Paint”

The critical rendering path refers to all of the assets that the browser needs to render to respond to the visitor’s current request. You want to prioritize the assets that are most important right now and load them as quickly as possible

It’s like traveling. If you need to get to an appointment on time and you’re running late, it’s probably not the best time to run quick errands or do a little sightseeing. Do that after!

This recommendation encompasses removing render-blocking resources, but it takes a broader perspective. You need to look at all of the work that the browser is doing to deliver the webpage and find a better way to serve the important bits and put off everything that can wait. If it isn’t critical then you can defer it or load it asynchronously in order to deliver a better performance.

Keep in Mind

As you start to optimize your site, it is important that you remember that the results returned by Google PageSpeed Insights only represents a single perspective. They’re simulated results, but they don’t fully capture reality.

Visitors who are visiting your site on crappy devices on a shoddy mobile connection will experience FCP and FMP that are much much longer. All the more reason to continue improving even if you get a perfect 100.

Your goal should always be to optimize your site for real users, not a gold star ;)

Summary

First Contentful Paint and First Meaningful Paint are user-centered metrics that can tell you a lot about how long your visitors are waiting for content. Both should be less than a second for the best user experience. You can find out how your site scores with Google PageSpeed Insights.

If your site is too slow, the best way to improve time to first paint is to minimize render-blocking resource, use HTTP caching, minify and compress text-based assets, do less JavaScript work and optimize the critical rendering path. If you’re not sure what you need to do, running a Google PageSpeed Insights test will give you targeted suggestions for your site.

If you’re not sure how to improve your paint times, Hummingbird makes it easy. Get Hummingbird free on WordPress.org or try Hummingbird Pro free for 30-days.