To remove the Gutenberg block library CSS, dequeue the wp-block-library style on the wp_enqueue_scripts hook with a priority above 10, and add wp-block-library-theme and classic-theme-styles if they appear in your source too. The code is below. Check what your site actually loads first, though. Since WordPress 6.9, most sites no longer load the big 137 KB block-library/style.min.css at all, so removing the block CSS saves far less than it used to.
This guide covers both jobs: removing block CSS on sites that never show blocks, and making sure sites that do use blocks load only the styles they need. It is checked against the WordPress 7.1 source code.
- The block library stylesheet has the handle
wp-block-library. You remove it withwp_dequeue_style()on thewp_enqueue_scriptshook at a priority above 10. - Only remove it if no blocks render on your front end. Posts written in the block editor, widgets and plugins can all use block styles.
- Since WordPress 6.9, classic themes load block CSS on demand, like block themes have since 5.9. The 137 KB
style.min.cssis replaced by a 4 KBcommon.min.cssplus styles for only the blocks on the page. - We checked 1,149 top WordPress sites: of the 619 whose block CSS we could see, 24.4% still loaded the full file. On sites running 6.9 or later, only 7.4% did.
- If your source still shows
style.min.cssand you do use blocks, switching on-demand loading back on is a better fix than removing the stylesheet. _transient_wp_core_block_css_filesis just WordPress caching the list of core block CSS files. It is safe to delete and rebuilds itself.
Check what your site loads first
Open any page on your site, view the source (Ctrl+U on Windows, Cmd+Option+U on a Mac) and search for block-library. What you find tells you which mode WordPress is in:
- A link with the ID
wp-block-library-csspointing to/wp-includes/css/dist/block-library/style.min.cssmeans you are loading the full combined stylesheet, with CSS for every core block whether the page uses it or not. - A link to
common.min.css, or a<style id="wp-block-library-inline-css">tag, means WordPress is loading block styles on demand. You will also see small tags likewp-block-paragraph-inline-cssfor each block on the page. - No block library at all means something already removed it, or an optimization plugin has combined your CSS into its own files.

Every block style in your page source, explained
WordPress prints several block-related stylesheets, and their IDs are what most people end up searching for. Each ID is the style handle plus -css for a linked file, or -inline-css when the CSS is printed inline. WordPress inlines small stylesheets automatically, up to a total of 40 KB per page since version 6.9.
| ID in your source | What it is | Safe to remove? |
|---|---|---|
wp-block-library-css or wp-block-library-inline-css | The block library: the full style.min.css (137 KB) or, with on-demand loading, common.min.css (4 KB). The inline version can also be extra CSS a plugin attached to this handle. | Only if no blocks render on your front end. |
wp-block-library-theme-inline-css | Optional “opinionated” block styles, 2.7 KB, for themes that declare wp-block-styles support. | Only if no blocks render. |
wp-block-paragraph-inline-css and similar | Styles for one block that is on this page, loaded on demand. | No. It is there because the block is. |
classic-theme-styles-inline-css | A 291-byte stylesheet for themes without a theme.json file, so the Button and File blocks display correctly. | Only if no blocks render. |
global-styles-inline-css | CSS generated from theme.json: preset colors, font sizes, spacing variables and layout rules. | Only if your theme and content use none of the presets. |
core-block-supports-inline-css | CSS for block settings such as layout, gap spacing and link colors on the blocks on this page. | No. Removing it breaks those settings. |
wp-img-auto-sizes-contain-inline-css | A one-line fix for lazy-loaded images that use sizes="auto". Not block CSS. | No. |
wp-emoji-styles-inline-css | Styles for WordPress’s emoji script. Not block CSS. | Yes, as part of disabling emojis. |
wc-blocks-style-css | WooCommerce’s block styles. | Only if you use no WooCommerce blocks. |
Why WordPress 6.9 and later load far less block CSS
Block themes have loaded only the styles for blocks on the page since WordPress 5.9, because they render the whole template before printing the <head>. Classic themes print the <head> first, so WordPress did not know which blocks would appear and loaded the entire block library up front on every page.
WordPress 6.9 fixed that for classic themes. It now buffers the page output, prints a small common stylesheet in the head, and moves the styles for blocks that actually render up into the <head> before the page is sent. The WordPress 6.9 frontend performance field guide measured 45% less CSS on average on a sample page across the bundled classic themes.
| File (WordPress 7.1) | Size | Compressed (gzip) | When it loads |
|---|---|---|---|
block-library/style.min.css | 137 KB | 18.5 KB | On-demand loading is off: classic themes before 6.9, or a site that turned it off |
block-library/common.min.css | 4.1 KB | 1.2 KB | On-demand loading is on (block themes, and classic themes since 6.9) |
block-library/theme.min.css | 2.7 KB | 0.7 KB | Themes with wp-block-styles support, when on-demand loading is off |
classic-themes.min.css | 0.3 KB | 0.2 KB | Themes without a theme.json file |
| Per-block files, for example Paragraph, Button and Image | 0.6 KB, 2.5 KB and 8.6 KB | 0.3 KB, 0.6 KB and 1.8 KB | Only when that block is on the page |
The change shows up on real sites. In September 2026 we checked the homepages of 1,149 WordPress sites in the Tranco top 20,000, the same sample as our WordPress version study. Of the 619 whose block library we could see, 24.4% still loaded the full style.min.css. Split by version, 66 of the 74 sites on WordPress 6.8 or older (89%) loaded the full file, against 24 of the 325 sites on 6.9 or later (7.4%). Another 530 sites showed no block library stylesheet at all, either because they removed it or because an optimization plugin had merged it into its own CSS files.
How to remove block library CSS with PHP
Use this only if no blocks render anywhere on your front end, for example a site built entirely with the Classic Editor and a classic theme, or with a page builder that does not use core blocks. Blocks can still sneak in through widgets, WooCommerce or other plugins, so check a few page types after you add it.
Add the snippet to your child theme’s functions.php file or with a plugin like Code Snippets:
/**
* Remove block CSS from the front end.
* Only use this if no blocks render on your site's front end.
*/
function smartwp_remove_block_css() {
wp_dequeue_style( 'wp-block-library' ); // Block library (style.min.css, or common.min.css with on-demand loading)
wp_dequeue_style( 'wp-block-library-theme' ); // Optional block styles for themes with wp-block-styles support
wp_dequeue_style( 'classic-theme-styles' ); // Button and File block styles for themes without theme.json
wp_dequeue_style( 'wc-blocks-style' ); // WooCommerce block styles, if WooCommerce is active
}
add_action( 'wp_enqueue_scripts', 'smartwp_remove_block_css', 100 );
The priority of 100 matters. WordPress enqueues these styles on the same hook at the default priority of 10, so a dequeue that runs earlier has nothing to remove yet. Dequeuing a handle that is not loaded does nothing, so the WooCommerce line is harmless on sites without WooCommerce.
Global styles need a different approach. On classic themes WordPress now prints them near the end of the page and moves them into the head, so a dequeue at wp_enqueue_scripts misses them. Remove both of the actions that print them instead, but only if nothing on your site uses theme.json presets like has-vivid-red-color or --wp--preset--font-size--large:
// Optional: also remove the theme.json global styles.
remove_action( 'wp_enqueue_scripts', 'wp_enqueue_global_styles' );
remove_action( 'wp_footer', 'wp_enqueue_global_styles', 1 );
If you later switch to the block editor, remove these snippets, or your blocks will lose their styling. They only affect CSS on the front end. They do not disable the editor itself.
If you use blocks, load only what they need instead
Removing the block library on a site that uses blocks breaks galleries, columns, buttons, image alignment and embeds. If your source still shows the full style.min.css, the better fix is to make sure WordPress is loading block styles on demand.
On WordPress 6.9 or later, classic themes do this automatically. If you still see style.min.css, something turned it off: a theme or plugin returning false from the should_load_separate_core_block_assets filter, or a plugin that disables WordPress’s template output buffer. Search your theme and plugins for that filter name. On older versions, or to turn it back on explicitly, add:
// Load core block styles only for the blocks on each page.
add_filter( 'should_load_separate_core_block_assets', '__return_true' );
On classic themes before 6.9, or with the output buffer turned off, those per-block styles print at the bottom of the page, which can cause a brief flash of unstyled content. On 6.9 and later, WordPress moves them into the head for you.
How to remove block library CSS with a plugin
If you would rather not touch code, Asset CleanUp can unload the block library for you. It is free, has 100,000+ active installs, and is tested with WordPress 7.1.
After installing the plugin, go to Asset CleanUp, then Settings, then Common Site-Wide Unloads, and switch the “WordPress Block Library CSS” option to “Unload site-wide”. The plugin shows its own warning next to it: using the Classic Editor alone does not guarantee that block styles are unused. Check your pages after saving.
What is _transient_wp_core_block_css_files?
If you found _transient_wp_core_block_css_files in your wp_options table, it is not a problem. Since WordPress 6.3, core caches the list of core block CSS file paths in this transient so it can register each block’s stylesheet without scanning the filesystem on every request. It is only used when block styles load on demand.
The cached list is tied to your WordPress version, so it refreshes itself after every update. Deleting it is safe: WordPress rebuilds it on the next page load.
Frequently asked questions
What is wp-block-library-css?
It is the ID of the link tag for WordPress’s block library stylesheet, the style handle wp-block-library plus -css. On WordPress 6.9 and later it usually points to common.min.css, a 4 KB file of shared block styles. On older versions, or when on-demand loading is off, it points to the full 137 KB style.min.css.
Is it safe to remove the block library CSS?
Only if no blocks render on your front end. Posts written in the block editor, block widgets, WooCommerce and other plugins can all rely on block styles, so using the Classic Editor alone does not guarantee they are unused. Check several page types after removing it.
Why is wp-block-library still loading after I dequeued it?
Usually one of three things. The dequeue ran before WordPress enqueued the style, so use the wp_enqueue_scripts hook with a priority above 10. Another stylesheet lists wp-block-library as a dependency, and WordPress always prints dependencies. Or you are looking at a cached page, so clear your page cache and check again.
What is global-styles-inline-css?
It is CSS WordPress generates from theme.json settings: preset color and font size classes, CSS variables such as –wp–preset–color–black, and layout rules. It appears on classic themes too, because WordPress ships default presets. Remove it only if nothing on your site uses those presets.
Does removing the block library CSS make WordPress faster?
It depends on what your site loads. Removing the full style.min.css saves about 18.5 KB of compressed, render-blocking CSS. On WordPress 6.9 or later with on-demand loading, the file is common.min.css at about 1.2 KB compressed, so removing it makes little difference.
Does removing block CSS disable the block editor?
No. These snippets only change which CSS loads on the front end. To switch the editor itself back to the classic editor, use the Classic Editor plugin.
What is classic-theme-styles-inline-css?
A 291-byte stylesheet WordPress adds for themes that have no theme.json file, so the Button and File blocks display correctly. It has been added automatically since WordPress 6.1.
Removing unused CSS is one of the easier performance wins in WordPress, but it is rarely the biggest one. For the rest, see our guide to speeding up WordPress and how to eliminate render-blocking CSS and JavaScript.



92 Responses
// Alternative// Fully Disable Gutenberg editor.
add_filter('use_block_editor_for_post_type', '__return_false', 10);
// Don't load Gutenberg-related stylesheets.
add_action( 'wp_enqueue_scripts', 'remove_block_css', 100 );
function remove_block_css() {
wp_dequeue_style( 'wp-block-library' ); // Wordpress core
wp_dequeue_style( 'wp-block-library-theme' ); // Wordpress core
wp_dequeue_style( 'wc-block-style' ); // WooCommerce
wp_dequeue_style( 'storefront-gutenberg-blocks' ); // Storefront theme
}
Thanks for the tip! This is good to know since mine assumed you were using the classic editor plugin.
Thanks faruk yetkin!!! Your code helped to finally remove the block library css. Awesome!!!
You'll still need that plugin, this just removes additional CSS files that are loaded
Does this mean we don’t need the Classic Editor plugin with this?
You’ll still need that plugin, this just removes additional CSS files that are loaded
Hi Andy, since I added this code snippet
add_filter( 'use_block_editor_for_post_type', '__return_false', 10 );I don’t even use that Classic editor plugin (for what? cause it sets WP back to the state it was before Gutenberg era)All works flawless, so highlight ppl why you think it is still needed please.
This worket fine
Sorry, but I wished it worked for me! I wasn’t sure where to put it, so tried at top of funcionts.php and at bottom – neither worked,
Sorry Mike! The location in functions.php shouldn’t matter. But you could try increasing the priority of the action. Let me know if changing
add_action( 'wp_enqueue_scripts', 'smartwp_remove_wp_block_library_css' );to
add_action( 'wp_enqueue_scripts', 'smartwp_remove_wp_block_library_css', 9999 );Thanks, Andy. Nice to get some advice – it’s a minefield to a newbie!
Thanks Andy – not using Gutenberg and looking to make some speed gains. This is a great little snippet to have.
Glad it helped Chris! be sure to remove it if you ever want to use Gutenberg though.
Thanks Andy – not using Gutenberg and looking to make some speed gains. This is a great little snippet to have.
Glad it helped! and yeah it’s odd the classic editor plugin doesn’t do this for you.
Superb, i am using classic editor plugin, but was unaware that new editor also includes a css file. This code removes the css. Perfecto…..
Hi Andy, thanks for the code. I’ve been looking for this. Thank you.
Glad to help Carl!
Thanks faruk yetkin!!
Awesome!
Thank you for the tip.
Is the snippet safe to use when I’m using WooCommerce? My website is an eCommerce website that uses heavily on WooCommerce and I noticed this line of code:
wp_dequeue_style( ‘wc-block-style’ ); // Remove WooCommerce block CSS
Will this affect the front-end?
Thank for the reply.
Hey Clay, if you are not using Gutenberg it shouldn’t affect the front end.
@Andy Awesome! Thank you for this guide!
thx mucho 😉
Helped a lot. Don’t need Gutenberg-Kindergarten.
This is good but is there a way to entirely disable the customizer too? I hate that whatever i do to keep my source code clean it’s still loaded with junk inline css. I’m using WP5.5 with a custom Storefront child theme. Thanks!
Hey Victor, I don’t think there is an easy way to disable the WP customizer (I assume you mean the customize button in the header). You can use a role editor plugin to disable usage for admins on your site though. Not sure if that is a solution you’d want but I don’t think disabling the customizer will lead to any performance improvements.
I tried your solution, but it doesn’t work.
Is still there.
I’ve been dealing with this problem for days. Thank you so much Andy & Faruk 🙂
Hi Andy,
Thank you for your great advice about removing the Gutenberg Block Library CSS. Help my website a lot.
Best wishes 🙂
didn’t work
For anyone trying this with the Avada theme you might notice it only works for the woo commerce styles.
I was sure my pages where not using gutenberg blocks so I had to set:
Avada > Options > Advanced > Theme Features > Load Frontend Block Styles
To “Off” for the styles to stop loading.
Thank you very much! 😀
Thank you so much!
Hi All, This is very interesting about the CSS from the Block editor. I am curious to know if anyone has tried to get the WP Core team developers to add “do not load block editor css” as an option in the General Settings, or do you think it is better that the theme developers implement it as an option on their side?
For myself, I have always viewed WordPress as a great engine on which to add on to, either with my own custom-written themes, or with a website builder like Elementor. I have inherited various sites that are built in Divi, WP Bakery, Beaver Builder, among others, and each case there is no real need for the Block Editor css.
It seems so futile to have to disable something in “core” and really, I wonder why the core code can’t be more intelligent and decide whether or not to load all of the block editor css, much in the way that a plugin like Contact Form 7 knows when to add its CSS in. Is it now the case that a page building tool should be smart enough to know whether or not to load the Block editor CSS/JS?
I also recall that either Drupal or Joomla offered a choice of editors, but I suppose that train has left the station for WordPress. I am increasingly alarmed by the amount of code that WordPress core is adding.
Make a PR! WordPress is open source and it’s always looking for more contributors.
Thank you so very much.
Bit late to the party but this doesn’t work for me unfortunately
thanks for this code
i used it..
Hey! Thank you – this can greatly improve page speed. I wonder how I can tweak this to only remove Gutenberg on certain pages.
doesn’t work unfortunately in 2021 with WP 5.8
Have to change a line to make it work as someone changed spelling somewhere in WP, they changed wc-block-style into wc-blocks-style
Below the old line:
wp_dequeue_style( ‘wc-block-style’ ); // WooCommerce
Below the new line:
wp_dequeue_style( ‘wc-blocks-style’ ); // WooCommerce
Thank you for the info!
ave to disable something in “core” and really, I wonder why the core code can't be more intelligent and decide whether or not to load
to add “do not load block editor css” as an option in the General Settings, or do you think
Retseem’s comment is exactly right — for some reason, they changed the spelling to “wc-blocks-style”. Please be sure to update this article and make the change in your own code!
Being able to get rid of Gutenberg by using one line of snippet is more than amazing. Thank you.
Is there any problem after updating WordPress and the plugin?
Hi, unfortunately your code does not work.
And to my delight I used faruk yetkin’s response code and it works for me.
You should point out to friends that if they have <? Php and probably everyone has, then it should be removed, otherwise the site is down!
thanks anyway!
Thank you very much indeed for this information. My Google PageSpeed mobile score went up from 45 to 55. I just added this code. And it went up 10 points.
I improved your code and added the is_user_logged_in() query. I suggest you add. The css files work when I login. Other times it won’t work.
I also added this to the code.
wp_deregister_style( ‘dashicons’ );
I also removed the dashicons css file with this function. Thus, my score increased from 55 to 60. Thank you so much.
Final version of my code:
function smartwp_remove_wp_block_library_css(){
if ( ! is_user_logged_in() ) {
wp_dequeue_style( ‘wp-block-library’ );
wp_dequeue_style( ‘wp-block-library-theme’ );
wp_dequeue_style( ‘wc-block-style’ );
wp_deregister_style( ‘dashicons’ );
}
}
add_action( ‘wp_enqueue_scripts’, ‘smartwp_remove_wp_block_library_css’, 100 );
Thank you Şekilli and Andi,
Before I’m assuming with Classic Editor plugin installed, all CSS related to Gutenberg block editor are gone. Now I can reduced unused script on homepage.
Hello, please. I use this line of code on my website to retain the classic editor: add_filter( ‘use_block_editor_for_post_type’, ‘__return_false’, 10 );
Do I still need this code as suggested by faruk yetkin.
// Fully Disable Gutenberg editor.
add_filter(‘use_block_editor_for_post_type’, ‘__return_false’, 10);
// Don’t load Gutenberg-related stylesheets.
add_action( ‘wp_enqueue_scripts’, ‘remove_block_css’, 100 );
function remove_block_css() {
wp_dequeue_style( ‘wp-block-library’ ); // Wordpress core
wp_dequeue_style( ‘wp-block-library-theme’ ); // Wordpress core
wp_dequeue_style( ‘wc-block-style’ ); // WooCommerce
wp_dequeue_style( ‘storefront-gutenberg-blocks’ ); // Storefront theme
}
Thanks for the php code. its working
Thanks its working. Nice
Thanks its working
Nice,
This gutenberg css affect my theme on thumbnails, removing it, does a perfect job since I build my own page with bootstrap.
It works for me. Im using elementor so I dont need Gutemberg at all.
Thanks
Thank you, it solved my problem, make site load faster!.
Thank you. it worked.
Thank you for your great advice about removing the Gutenberg Block Library CSS. It worked for me.
Thanks for info, it solved my problem
how about removing it for anonymous users only? That would solve the problem if you are using it for your site.
The code in the post works great, but it conflicts the YouTube embed from block editor. It resize the dimension of the embed video 25% (also not responsive on mobile) in the published post or in preview.
After doing some testings i found only this line is creating conflict:
wp_dequeue_style( ‘wp-block-library’ );
If i am removing this line from code, the embed video shows perfectly on PC or Mobile (Responsive also).
Any fix, if this code dose not affect YouTube embed.
Note: If i embed YouTube video from classic editor, every thing is fine.
Thanks for the helpful solution.
Happy it helped!
Yes it works but my website’s look has changed. Any suggestions ?
Are you using Gutenberg? likely you are if the design of your site has changed with this snippet.
With the new wordpress version my website is a kind of messed up.
Hey Stuart, in what regard?
Happy it made a difference! what’s more, definitely it’s odd the classic editor doesn’t do this for you.
Happy to hear!
How can I make only Gutenberg by Default for CPT’s and classic editor on rest of the posts? I’m a beginner in wp and if you have any solutions,
please lemme know
What an Amazing Article… Very Very Helpful Information Sir
A very unique and informative post. I really appreciate your effort you put in this vlog. keep sharing excellent job.
this amazing code for optimize site , thanks ^_^
Had some troubles at Google Page Speed with this script. For me it worked, thanks.
Thank you so much for this!
I’ve finally managed to pass my Core Web Vitals Assessment, and initial load is significantly down.
Have a great day.
thank you so much for this cod *_*
Let’s all just take a moment to breathe, please!
Thank you for your blog post. I found it to be informative and well-written. Your insights on the topic were very helpful, and I appreciate the effort you put into researching and presenting the information. Keep up the great work!
Some of my elements image and iframes and caption styles has changed.
Excellent! I’ve been utilizing the classic editor plugin, yet I wasn’t informed that the new editor also incorporates a CSS file. The provided code eliminates the CSS.
very usefull thanks
Hi, andy. thanks for your share this code.
that great for me and help me
thanks you
Thank you for posting this, I have been trying to optimize my code for SEO.
wow such a good post thanks a lot its really usefull
Thank you very much! It save my hours 🙂
thanks its really nice post
its really helpfull
thanks its really nice post
its really helpfull
It broke my website (something about a fatal error) and I had to restore from a backup, which meant I lost all the work I’d done today 😭
Any idea why it would cause a critical error and the site not be able to load at all?
Thanks ,its really nice post.
This is good but is there a way to entirely disable the customizer too? I hate that whatever i do to keep my source code clean it's still loaded with junk inline css. I'm using WP5.5 with a custom Storefront child theme. Thanks!