Skip to content
FunnelGuard

Fix guide by FunnelsGuard

Unminified JavaScript and CSS: how to find and fix it

PRF-082Low impactOther toolBy FunnelGuardPublished Updated
On this page

What this issue is

Minification removes characters a browser does not need to run code: spaces, line breaks, comments and, for JavaScript, long variable names. The file behaves the same but has fewer bytes. An unminified file is sent exactly as the developer wrote it.

Tools such as Lighthouse and PageSpeed Insights report this as "Minify CSS" and "Minify JavaScript". It is different from compression (gzip or Brotli), which shrinks files while they travel over the network. You want both.

Same rule, fewer bytes

Unminified

  • Comments, indentation and line breaks are kept
  • Long, readable variable names
  • Several small files, each with its own overhead

Minified

  • Whitespace and comments removed
  • Short variable names in JavaScript
  • Files combined or trimmed where safe
Example: the same CSS before and after minifyingcss
/* Unminified */
.button {
  background-color: #ff6600;
  padding: 12px 24px;
}

/* Minified */
.button{background-color:#f60;padding:12px 24px}

Why it costs you leads or sales

Every extra byte has to be downloaded and parsed before the page can respond, especially on slow mobile connections. Slower pages lose some visitors before a form or checkout button appears. The effect of minification alone is usually small, which is why this issue is rated low impact.

Size of one stylesheetExample numbers
Size of one stylesheet (example)Unminified: 120 KB; Minified: 90 KB; Minified + Brotli: 20 KB046921209020UnminifiedMinifiedMinified + BrotliKB

Example: a 120 KB stylesheet might drop to about 90 KB when minified. Real savings depend on how the code was written.

How to check if your site has it

Find unminified files
  1. Run PageSpeed Insights or Lighthouse

    Test your landing page on mobile. Look under Diagnostics for "Minify CSS" or "Minify JavaScript" and note the listed files and estimated savings.

  2. Open the file in your browser

    Visit the file URL. If you see readable, indented code with comments, it is not minified. Minified code appears as a few very long lines.

  3. Check who owns each file

    Files from your theme or plugins can be fixed by you. Files from third parties (chat widgets, ad tags) are minified or not by their provider, so you cannot change them.

  4. Check compression separately

    In Chrome DevTools, open Network and look at the Content-Encoding header. You want gzip or br on text files.

How to fix it

Turn on minification for your platform
  1. Use one optimisation plugin

    Caching and performance plugins such as WP Rocket, LiteSpeed Cache or Autoptimize have a minify CSS and JavaScript option. Enable only one plugin that does this to avoid conflicts.

  2. Test key pages

    Turn on CSS first, then JavaScript. Check your form, menu and checkout after each change, because minifying or combining scripts can break some themes.

  3. Exclude files that break

    If something stops working, add that file to the plugin's exclusion list instead of turning minification off everywhere.

Minify single files from the command linebash
npx esbuild app.js --minify --outfile=app.min.js
npx esbuild styles.css --minify --outfile=styles.min.css

How to confirm it's fixed

Confirm the fix
  • Re-run PageSpeed Insights and check that the Minify CSS and Minify JavaScript items are gone or smaller
  • Open your CSS and JS URLs and confirm they are compact
  • Check the Content-Encoding header shows gzip or br
  • Submit your lead form and run a test checkout to make sure they still work
  • Check in your browser console that there are no new JavaScript errors

How to prevent it happening again

Keep files lean
  • Keep minification on in your build or caching plugin
  • Minify custom code before pasting it into a site builder
  • Run a speed test after adding themes, plugins or apps
  • Remove plugins and apps you no longer use
  • Add a performance check to your release checklist

How FunnelGuard handles this

This issue is outside what FunnelGuard checks. FunnelGuard runs your real customer journeys on a schedule and checks steps, tracking hits and whether test leads arrive. It does not audit file sizes or minification.

The kind of tool that fits is a page speed or web performance testing tool, such as Lighthouse or PageSpeed Insights, or a build-pipeline check. Use it to find unminified files, and use FunnelGuard to confirm that your forms and checkout still work after you change scripts.

Questions people ask

What does unminified JavaScript and CSS mean?

It means the files are sent with spaces, line breaks, comments and long names left in. Browsers do not need these to run the code. Minifying removes them so the file is smaller and behaves the same.

How do I minify CSS and JavaScript in WordPress?

Install one optimisation plugin such as WP Rocket, LiteSpeed Cache or Autoptimize and enable its minify CSS and JavaScript options. Turn them on one at a time and test your forms and menus after each change.

Does minifying CSS and JS improve SEO?

It can help a little by making pages faster, and page speed is one signal among many. On its own the gain is usually small, so fix larger problems such as heavy images first.

Why does Lighthouse say Minify JavaScript when my plugin already minifies?

The flagged files may come from a third party, or from a plugin or theme the optimiser skips. Check the file URLs in the report to see who serves them. Add them to your optimiser, or accept it if they are third-party files.

Is minification the same as compression?

No. Minification rewrites the file to remove unneeded characters. Compression such as gzip or Brotli shrinks the file while it travels over the network. Use both for the smallest transfer.

Can minifying JavaScript break my website?

Yes, occasionally, especially when scripts are also combined or delayed. Forms, menus and tracking are the usual casualties. Test after each change and exclude any file that breaks instead of disabling minification altogether.

Can FunnelGuard detect unminified JS and CSS?

No. This needs a page speed or performance testing tool. FunnelGuard instead runs your forms and checkouts to check that they still work after you change scripts.

Does FunnelGuard catch this?

Other tool

Needs a different kind of tool.

Stop finding out from your customers

FunnelGuard runs your real forms and checkouts on a schedule, checks the tracking and the leads behind them, and alerts you once, with a screenshot. Try any paid plan free for 3 days.