How to Fix Unminified CSS and JavaScript Files on Your Site
Unminified CSS and JavaScript files still contain the whitespace, comments and long variable names that developers use but browsers don't need. This guide shows you how to find the unminified files your pages load, turn on minification at the source, swap third-party files for their .min versions, and confirm every CSS and JS file is now served compressed.

Why it matters
Minification usually cuts CSS and JS by 15-40% before gzip or Brotli is applied. The effect on rankings is small, which is why this is a low-impact warning. It still matters on mobile connections, where render-blocking CSS and large scripts delay First Contentful Paint and Interaction to Next Paint.
Unminified production files also often mean a site is shipping a development build, which can be slower and expose source comments, internal notes or debug code.
What you need
Step-by-step fix
List every unminified CSS and JS file
Our audit looks at every non-image asset a page loads, which means each stylesheet and script, and flags any file that isn't minified. Start from the list of URLs in your report. To find them yourself:
- Open the page, press F12, go to the Network tab and filter by CSS and then JS
- Click each file and open Response. If you see indentation, line breaks and /* comments */, the file is unminified
- Write down the URL and work out where it comes from: your theme, a plugin or app, your own build, or a third-party CDN
Enable minification in your build tool
If your site has a build step, minification is usually off because the site was deployed in development mode. cssMinify must not be set to false. webpack minifies JS when mode: 'production'` is set.
For CSS, add css-minimizer-webpack-plugin next to Terser. Rebuild the site and deploy the output folder (dist/ or build/), not your source files.
// webpack.config.js
const TerserPlugin = require('terser-webpack-plugin');
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
module.exports = {
mode: 'production',
optimization: {
minimize: true,
minimizer: [new TerserPlugin(), new CssMinimizerPlugin()]
}
};Turn on minification in your caching plugin
On a CMS without a build step, let your caching or optimization plugin minify files when it serves them. Use one plugin only:
- WP Rocket: Settings > WP Rocket > File Optimization > tick Minify CSS files and Minify JavaScript files
- Autoptimize: Settings > Autoptimize > JS, CSS & HTML > tick Optimize JavaScript Code and Optimize CSS Code
- LiteSpeed Cache: LiteSpeed Cache > Page Optimization > CSS Settings > CSS Minify ON, then JS Settings > JS Minify ON
Save your changes, then open a few key pages and check that menus, sliders and forms still work.
Minify standalone files by hand
Some files sit outside your build or plugin, such as a custom script uploaded through FTP. Minify these once with esbuild or Terser. Keep the original as your editable source, upload the .min file, and update the <link> or <script> tag so it points to the new file.
npx esbuild assets/css/custom.css --minify --outfile=assets/css/custom.min.css npx terser assets/js/custom.js --compress --mangle --output assets/js/custom.min.js
Switch third-party libraries to their .min builds
Libraries loaded from a CDN or bundled in a theme are often linked in their full development version. Almost every library publishes a minified build alongside it, so change the URL to point to that.
<!-- Before --> <script src="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.js"></script> <!-- After --> <script src="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.js"></script>
Purge caches and confirm the result
Clear your plugin cache, your server cache and your CDN cache. In Cloudflare that's Caching > Configuration > Purge Everything. Then load the page in a private window, open DevTools > Network, and check that every CSS and JS file now returns compact single-line content.
Finally, re-run the audit. The unminified file count should be zero, or limited to third-party scripts you don't control.
curl -s https://example.com/wp-content/cache/min/1/style.min.css | wc -l
Platform-specific notes
WordPress
Use one optimization plugin (WP Rocket, Autoptimize, LiteSpeed Cache, Perfmatters or similar). Running two plugins that both minify can produce broken or doubled output. Some hosts, such as SiteGround's Speed Optimizer, have their own minify toggles, so check those before adding another plugin.
Shopify
Shopify minifies theme asset files served from its CDN. Unminified warnings usually point to app scripts or custom files hosted elsewhere. Ask the app developer for a minified build, or remove apps you no longer use.
Next.js
`next build` minifies JS and CSS automatically with SWC and Lightning CSS. If files show up unminified, you are probably running `next dev` in production, or loading scripts from /public, which Next.js serves as-is. Minify those files yourself.
Cloudflare
Cloudflare retired Auto Minify in August 2024, so turning it on is no longer an option. Minify in your build or CMS instead, and keep Brotli compression enabled at the edge.
Webflow
Go to Site settings > Publishing > Advanced publishing options and switch on **Minify CSS** and **Minify JS**, then republish. Custom code pasted into embeds is not minified, so minify it before you paste it in.
Check that it worked
✅ How to verify
- Re-run the site audit and check that the Unminified CSS / JS file count drops to zero
- In DevTools > Network, open each CSS and JS file's Response tab and confirm there's no indentation and no comments
- Run `curl -s <file-url> | wc -l` on each file and expect only a handful of lines
- Compare file sizes in the Network tab before and after; CSS and JS should be noticeably smaller
⚠️ Common mistakes
- Deploying a development build (`npm run dev`, webpack `mode: 'development'`) to the live site
- Turning minification on but not purging the page cache and CDN cache, so visitors still get the old files
- Enabling minify in two plugins at the same time, which can break JavaScript
- Editing a .min file by hand, which gets overwritten the next time the site rebuilds
Is this still an issue on your site? Run a free audit — ZORO checks this and 294 other SEO, AI-visibility, accessibility and security signals, with fixes for your platform.
Check my site freeFAQ
Does minifying CSS and JS improve SEO?
Only indirectly. Smaller files load faster, which helps Core Web Vitals, especially on mobile. The direct ranking effect is small, so treat this as a quick win and don't expect big ranking changes.
Is minification still needed if my server uses gzip or Brotli?
Yes. Minification and compression work together. Minifying first removes comments and whitespace, and compression then shrinks what's left further. Using both gives smaller files than either one alone.
Can minifying JavaScript break my website?
Minification on its own rarely breaks anything. Most breakage comes from combining or deferring scripts. If something stops working, exclude that one file in your plugin's exclusion list rather than turning minification off for the whole site.
How do I fix unminified files from third-party scripts I don't control?
Switch to the vendor's .min URL if one exists. If not, contact the vendor or replace the script. The audit raises this as a warning only, so one or two external files you can't change won't fail the check.
How to Enable Gzip or Brotli Compression on Your Website
How to Fix Render-Blocking Resources on Your Website
How to Fix Browser Caching Headers on Static Assets
How to Fix Total Page Weight: Get Your Homepage Under 2 MB
How to Fix Next-Gen Image Formats: Serve WebP and AVIF
How to Fix Slow Time to First Byte (TTFB) on Your Website