As WordPress continues to evolve, it brings both unprecedented flexibility and technical complexities. One such complexity lies in optimizing performance — particularly removing unnecessary CSS that WordPress loads by default. A common example is the default Gutenberg block CSS, which is shipped whether or not you use the block editor. In modern performance-optimized websites, cleaning up unwanted styles like these becomes essential to reduce page weight and enhance speed.
TL;DR:
If you’re not using the Gutenberg editor or you’re using a custom theme or builder (like Elementor or Oxygen), WordPress may still be loading unused Gutenberg CSS on every page. This not only bloats your web pages but slightly slows down load times. You can safely remove it by deregistering specific styles using code snippets. However, you must take care to test thoroughly to avoid breaking styles on your front end or in the admin interface.
Why Gutenberg CSS Loads By Default
WordPress includes Gutenberg’s block editor as the default editing experience starting with version 5.0. As a consequence, even if you never use Gutenberg blocks on your pages, your site will still load its associated styles:
- wp-block-library-css – the core block styles
- wp-block-library-theme-css – additional theme CSS for Gutenberg
- global-styles – dynamic styles based on theme.json and settings
This can contribute around 50-100 KB (or more) of unused CSS being shipped unnecessarily, especially for sites that rely on custom editors or builders.
When Should You Remove Gutenberg CSS?
Not every site should remove Gutenberg CSS, and doing so improperly can break layouts. Here’s when it makes sense to remove it:
- Your site uses a custom builder like Elementor, Beaver Builder, Oxygen, or Bricks exclusively.
- You never use Gutenberg blocks anywhere — not even in widgets or footers.
- You want to reduce page load time by eliminating unused CSS.
- You’ve confirmed (with browser dev tools) that wp-block styles serve no purpose on your site.
However, if your theme or plugins use Gutenberg blocks (even for headers, footers, or widgets), removing these styles can break design or layout elements.
How to Identify Gutenberg CSS on Your Site
To determine whether Gutenberg CSS is loading, inspect your site’s front end:
- Right-click the page and choose “Inspect” (or use F12).
- Go to the “Network” tab.
- Reload the page and filter by CSS.
- Look for entries like style.min.css?ver=wp-block-library, wp-block-library-theme, or global-styles.
If you find them, you’re almost certainly loading unnecessary CSS — unless you’re using blocks somewhere on the page.
Safely Removing Gutenberg CSS: The Right Way
To remove these styles globally — and safely — you’ll need to conditionally deregister them using WordPress hooks like wp_dequeue_style or wp_deregister_style. Below is how you can do that efficiently.
Add This Snippet to Your Theme’s functions.php
function remove_gutenberg_css() {
if (!is_admin()) {
wp_dequeue_style('wp-block-library');
wp_dequeue_style('wp-block-library-theme');
wp_dequeue_style('global-styles');
}
}
add_action('wp_enqueue_scripts', 'remove_gutenberg_css', 100);
This function checks if the current request is for the front end (not admin area) and removes the queued Gutenberg CSS styles.
Alternative: Create a Custom Plugin
Instead of editing your theme files, you can package the same code in a plugin for easier maintenance. Here’s how:
- Create a new folder in
/wp-content/plugins/and name itremove-gutenberg-css. - Create a PHP file called
remove-gutenberg-css.php. - Add the following code:
<?php /* Plugin Name: Remove Gutenberg CSS Description: Deregister Gutenberg block library CSS. Version: 1.0 */ function remove_gutenberg_css_files() { if (!is_admin()) { wp_dequeue_style('wp-block-library'); wp_dequeue_style('wp-block-library-theme'); wp_dequeue_style('global-styles'); } } add_action('wp_enqueue_scripts', 'remove_gutenberg_css_files', 100); - Go to Plugins in your WordPress dashboard and activate “Remove Gutenberg CSS.”
Make Sure You Test!
After making any change to CSS enqueuing or dequeuing, clear your cache and test your entire site:
- Check pages, posts, widgets, headers, and footers.
- Review both desktop and mobile layouts.
- Use dev tools to ensure none of the .wp-block classes are being applied.
If something breaks, undo the change or re-enable one or more of the dequeued styles.
Use Conditional Logic if Needed
Sometimes only specific post types or templates use Gutenberg blocks. In such cases, you can apply conditional logic:
function remove_gutenberg_styles_conditionally() {
if (!is_admin() && !is_singular('post')) {
wp_dequeue_style('wp-block-library');
wp_dequeue_style('wp-block-library-theme');
wp_dequeue_style('global-styles');
}
}
add_action('wp_enqueue_scripts', 'remove_gutenberg_styles_conditionally', 100);
This example ignores block CSS unless the user is on a single blog post.
Advanced: Unloading Gutenberg CSS via Asset Managers
Another non-coding option is to use an asset manager plugin. These allow you to selectively unload Gutenberg CSS per page or per post basis. Recommended plugins include:
- Asset CleanUp: Scan pages visually and disable CSS you don’t want.
- Perfmatters: Premium plugin with intuitive toggles for disabling Gutenberg styles.
These plugins are ideal for non-developers or those running complex sites where CSS needs vary between pages.
Cautions and Common Mistakes
While it’s beneficial to remove unused CSS, it’s just as easy to go overboard. If you’re not absolutely sure that block styles aren’t required, take a cautious approach. Common pitfalls include:
- Removing Gutenberg CSS globally while block-based widgets are in use
- Dequeueing styles in admin or editor screens, leading to rendering issues
- Forgetting to purge cache after making code changes, causing misleading results
Monitoring the Impact
It’s wise to measure the performance gains after cleanup. Use tools like:
- Google PageSpeed Insights – check reduced unused CSS
- GTmetrix – evaluate speed and waterfall changes
- WebPageTest – get a detailed breakdown of CSS loading
This will help you confirm whether the removal has a meaningful impact on performance.
Conclusion
Removing unused Gutenberg CSS from your WordPress site is a small but effective step toward better performance — especially if your site uses another builder or framework entirely. With careful testing and sound logic, you can reduce unnecessary styles and speed up page loads without affecting functionality. Always follow best practices: test diligently, use fallback measures like asset managers when needed, and monitor the gains.
WordPress offers endless flexibility, and by cleaning up what’s not needed, you ensure a faster and leaner experience for your users.