How to Remove Unused CSS

How to Remove Unused CSS?

Ashkar Gomez
11min read
Table of Contents

Have you ever faced remove unused CSS as an error, while auditing your website for performance in lighthouse or page speed insight? If so you are in the right place to learn about the error and fix it.

Unused CSS (Cascading Style Sheets) refers to the codes not utilized on the webpage but increases the page size and eventually increases the loading speed unnecessarily.

This could harm the performance of core web vitals like LCP, INP, and CLS.

Further down, you will learn how unused CSS impacts a website’s performance and ways to remove it.

What is Unused CSS?

Unused CSS is a portion of CSS code within the website or web application that is not actively applied to any elements on the page.

In another way to be clearly explained, Unused CSS consists of CSS rules defined in the stylesheet but not utilized in styling any visible elements on the webpage.

How unused CSS impacts Website's performance?

Unused CSS impacts a website’s performance in several ways 

1. Increase in Loading Speed:

Unused CSS rules contribute to the overall file size of CSS files. 

When browsers download CSS files, they have to parse through all the rules, including the unused ones, which can increase loading times, especially on slower connections.

2. Affects Rendering: 

When a browser encounters unused CSS rules, it still needs to render them, even if they don’t affect any visible elements on the page. 

This extra rendering time can slow down the overall rendering process, causing delays in displaying content to users.

3. Reduces Cache Efficiency:

Unused CSS rules are still downloaded and stored in the browser’s cache, taking up valuable space. 

This can reduce the efficiency of the cache, as it may store unnecessary styles that aren’t being utilized by the webpage.

4. Affects Mobile Performance 

On mobile devices with limited processing power and bandwidth, the impact of unused CSS can be even more noticeable. 

Longer loading times and slower rendering can lead to a poor user experience and higher bounce rates in mobile phones.

How to identify unused CSS?

You can identify Unused CSS using the most common methods to identify the CSS codes.

1. Chrome DevTools Coverage Tab

The Chrome DevTools Coverage tab helps detect unused JavaScript and CSS code.

Chrome DevTools Coverage Tab

The above picture shows that 1.3 MB of 1.8 MB are not used and these unused CSS files and JS files affect the loading speed of the website.

This is one way you can identify the Unused CSS files.

2. Page Speed Insights

You can identify the CSS while analyzing your website in Page Speed Insights.

Page Speed Insights Reduce Unused CSS

As an advantage, it also shows the recommendations to use WordPress plugins to reduce the unused CSS.

3. GT Metrix

GT Metrix tool also shows the Unused CSS files, It provides reports on all stylesheets containing at least 2 KB of CSS that was not utilized in rendering above-the-fold content.


Image from GT Metrix

GT Metrix gives recommendations and tips to reduce unused rules from stylesheets.

Types of unused CSS

Unused CSS mostly falls into these categories, 

Redundant CSS:  

CSS Styles that were previously used but have become redundant due to design changes, and updates.

Global CSS Not Applied: 

CSS rules are defined globally but are not applied to any elements within the current context of the webpage.

Conditional CSS: 

Styles that are conditionally applied based on certain states or conditions of the webpage or user interactions, but those conditions are not met.

Framework or Library CSS: 

Predefined styles and components from CSS frameworks, libraries, or third-party plugins that are not used in the current project.

Dynamic or Generated CSS: 

Styles are generated dynamically by scripts or plugins that may not be utilized due to changes in the web page’s content.

Legacy CSS: 

Outdated styles that were once used but are no longer relevant or necessary for the current design of the website.

Unused Media Queries: 

CSS rules within media queries are not applied because the conditions specified in the media query are not met.

Overridden CSS: 

Styles that are overridden by more specific or higher-priority CSS rules, render them effectively unused.

Once developers identify what is the cause of Unused CSS, they will proceed with removing them.

How to Remove Unused CSS?

You can either manually remove unused CSS codes or use tools and plugins to do the job efficiently.

Manual removing needs developers’ support and it can be done using Chrome DevTools, If you need a detailed explanation, resources are available at Chrome Developer’s website.

Now, we will look into some plugins and tools to remove CSS.

How to Remove Unused CSS in WordPress Using WP Rocket?

Install and activate the WP Rocket plugin on your WordPress website

After successful activation, navigate to the Settings » WP Rocket page in your WordPress dashboard.

Once on the WP Rocket settings page, switch to the ‘File Optimization’ tab.

Scroll down to the ‘CSS Files’ section and check the box next to the ‘Remove Unused CSS (Beta)’ option.

Since this feature is in beta, confirm your choice by clicking the ‘Activate Remove Unused CSS’ button when prompted.

After activation, specify any CSS filenames, IDs, or classes that should not be removed by entering them into the ‘CSS safelist’ box.

Scroll down and click the ‘Save Changes’ button to save your settings.

WP Rocket will begin processing your CSS files, and you’ll see a progress bar. Wait for the plugin to complete the process.

Once the process is complete, you’ll receive a notification stating ‘Remove Unused CSS is complete!’

How to remove unused CSS from Elementor?

In Elementor Experiments, you can go to “Improved Asset/CSS Loading” to remove unwanted CSS. 

Here’s how to make it work:

Go to Elementor Testing: In your WordPress dashboard, go to Elementor » Settings » Testing.

Scroll down to find the “improved property/CSS loading” option. Toggle it to enable this feature.

Elementor CSS Loading

After activating the item, be sure to save your changes by clicking the “Save Changes” button.

Once enabled, test your Elementor-powered website to ensure that unwanted CSS is successfully removed and performance improvements are noted.

Enabling the “Improved Asset/CSS Loading” feature in Elementor Experiments helps simplify CSS loading by ensuring that only necessary styles are included.

Tools to Remove Unused CSS

Unused CSS: 

This easy-to-use tool scans your live website and removes unused CSS code, saving memory. 

Unused CSS

While it offers a free trial, a monthly subscription is required to download clean CSS files and get rich features. 

However, since it only works with a live web browser, it is not suitable for the testing phase.


This free tool removes unused CSS from HTML, PHP, JavaScript, and CSS files before they go live. 

Purify CSS

Searching requires manually navigating through the files, which can be tedious. This produces excellent CSS outputs into new files and is suitable for development programs but not live websites.

Tips to Reduce Unused CSS

Here are some actionable tips that will help you reduce unused CSS and streamline your Elementor designs:

Use Fewer Widgets:

Elementor gives an extensive range of widgets and column layouts to create lovely web designs. 

However, using too many widgets and columns can result in excessive CSS being generated. 

Simplify your layouts by the usage of fewer widgets and columns. This not only reduces the amount of CSS code but also improves page overall page performance.


Disable Unused Icons: 

Elementor comes with a library of icon sets that you can use to decorate your designs. However, not all icons may be necessary for your website.

In the Elementor settings, disable unused icon units to prevent unnecessary CSS from being loaded. This helps streamline your stylesheet and reduce file size.


Disable Unused Plugins 

Plugins can add additional CSS stylesheets to your pages, even if they’re not actively used on the webpage. 

Identify plugins that aren’t important for specific pages and deactivate them for that reason. 

This prevents useless CSS from being loaded and facilitates enhanced web page loading speed.


Lazy Load CSS Background Images: 

CSS background images can significantly contribute to CSS file size. 

Implement lazy loading for CSS background images to delay their loading until they are needed. 

This optimization technique helps reduce initial page load times, especially for pages with large background images.


Disable WooCommerce Styles On Non-eCommerce Content: 

If your website includes WooCommerce functionality, WooCommerce stylesheets may be loaded on every page by default. 

However, if certain pages do not require WooCommerce styling, disable these styles to prevent unnecessary CSS from being loaded. 

This optimization is particularly beneficial for non-eCommerce content pages.


Minify CSS: 

Minification is a process that removes unnecessary whitespace, comments, and formatting from CSS files, reducing file size and improving loading speed. 

Utilize CSS minification tools or WP plugins to automatically minify your CSS files. This optimization technique helps optimize your stylesheet for better performance.

By implementing these tips, you can effectively reduce unused CSS and optimize your Elementor-powered website for improved performance and faster loading times.


Removing Unused CSS is a good option for optimizing a website’s performance, removing files that are not utilized will clear up the space and load the page fast. Now that you have a clear understanding of how to reduce Unused CSS and some tips to optimize CSS files.

It can be done manually by yourself using any of the ways mentioned or If you need help in implementing, refer to our technical SEO services which helps to clear all your technical errors, connect with us, we are ready to help.

Picture of Ashkar Gomez

Ashkar Gomez

Ashkar Gomez is the Founder of 7 Eagles (a Growth Marketing & SEO Company). Ashkar started his career as a Sales Rep in 2013 and later shifted his career to SEO in 2014. He is one of the leading SEO experts in the industry with 8+ years of experience. He has worked on 200+ projects across 20+ industries in the United States, Canada, the United Kingdom, UAE, Australia, South Africa, and India. Besides SEO and Digital Marketing, he is passionate about Data Analytics, Personal Financial Planning, and Content Writing.

Table of Contents

Related Articles

Your Business
Starts Here

Let’s Have a Cup of Digital Tea

Request Your Free Quote

Book Your Free Marketing Consultation

Your Monthly ads spend
Convenient Time To Call