Removing unused CSS on your WordPress website can easily increase your overall performance. In this guide, we share an easy guide to “Remove Unused CSS” from your WordPress website using simple plugins. And you don’t need any coding experience to fix this problem. So, let’s get started.
Table of Contents
What is unused CSS?
Unused CSS refers to styles that are defined in a CSS stylesheet but are not being applied to any elements in the HTML document. This can happen for a variety of reasons, such as when a developer has removed or changed elements without deleting the associated CSS code or when CSS styles are defined for elements that no longer exist in the HTML document.
Having unused CSS in a stylesheet can increase the dead weight of your application’s file. It can also slow down the rendering of a webpage, as the browser still has to download and parse the unused CSS.
The easiest way to identify unused CSS on your website, you’ve to test the URL with PageSpeed Insights. If there is unused CSS on your website, you’ll see a warning “Reduce unused CSS“, like the one below.
Aside from slowing down your website’s overall performance, unused CSS has a huge impact on Core Web Vitals metrics such as First Contentful Paint (FCP), Largest Contentful Paint (LCP), and Time to Interactive (TTI). That means it can also affect your website’s overall SEO performance.
How to Remove Unused CSS on WordPress Website?
There are many tools available that can helps you to identify unused CSS like Chrome DevTools Audits panel and then you can use CSS optimization tools like PurgeCSS, UnusedCSS, or PurifyCSS to remove unused CSS. These tools automatically scan your website’s HTML and CSS files and identify unused CSS styles and allowing you to manually remove them from your website.
However, if you are not a techy person you need to use a WordPress plugin to remove unused CSS from your website. As for this guide, we listed a few WordPress plugins that can help you to remove unused CSS automatically from your website to improve performance.
There are many WordPress plugins that can help you to remove unused CSS from your website automatically. In this guide, we listed only listed three plugin WP Rocket, Perfmatters, & FlyingPress. Now, let’s see how you can use this plugin to reduce unused CSS to improve website performance.
Method 1: Using WP Rocket to reduce unused CSS
WP Rocket is one of the most popular WordPress cache plugins that helps you to remove unused CSS automatically with a single click. On WP Rocket you’ll get two different options to handle unused CSS on your website.
WP Rocket recommends you use the “Remove Unused CSS” option to for optimal performance. However, if you face a design error on your site, you can use the “Load CSS Asynchronously” option to reduce unused CSS.
As you can see, using WP Rocket is easy, and straightforward, you don’t need technical knowledge is required to use the WP Rocket cache plugin. However, WP Rocket is a premium plugin and it not only reduces unused CSS, but it also improves website performance. Download WP Rocket Plugin.
Method 2: Using Perfmatters to reduce unused CSS
Perfrmatters also remove unused CSS from your website with a single click. Perfmatters is different from WP Rocket, with this plugin, you can select how your unused CSS stylesheets should behave.
After installing Perfmatters plugin on your website, open the “Assets” tab. Here, Perfmatters offer three different methods to choose from on how the unused CSS is handled on your website.
- Delay (Recommend): All unused CSS will be delayed and loaded on user interaction.
- Async: All unused CSS is loaded via async. It means all stylesheets are executed asynchronously as the page loads.
- Remove: All unused CSS will be removed automatically. This is the most aggressive & advanced method to solve this issue.
Note: removing all unused CSS files sometimes can break the user interface. I recommend you select the “Delay option” to solve this issue without breaking your website design in the future. Download Perfmatters Plugin.
Method 3: Using Flyingpress to reduce unused CSS
Like the Perfmatters plugin, Flyingpress also uses three different options to handle unused CSS on your website. FlyingPress recommends you use the “Asynchronously” option to safely handle unused CSS.
In my experience, don’t use Flyingpress remove option if you are using a page builder on your website. It breaks your website design. You can use the “On user interaction” option, but it sometimes increases LCP on the Google Pagespeed test. Download FlyingPress plugin.
If you still wondering if these plugins working or not. You can now test your website URL on Google Pagespeed Insights to see the change in the unused CSS warning. I personally use the WP Rocket plugin on this website, here’s my website performance:
Apart from installing this plugin, you need to make sure to use a lightweight theme on your websites. I recommend you use GeneratePress, Astra, or OceanWP theme on your website. And if possible try to avoid using drag & drop page builders like Beaver Builder, Elementor, or Thrive Architect.
If you still having problems related to setup this plugin on your website. Here’s my guide, which you can use to improve your website performance.
Read more about:
- Best WP Rocket settings.
- Best FlyingPress settings.
- Best Perfmatters settings.
- How to Serve Images in Next-gen Formats?
- How to reduce server response time?
We hope this article helped you to remove unused CSS from your WordPress site with a single click. If you have any other questions let me know in the comment section.
Thank you. Have a nice day.