CSS & JS Minification Test
Short answer
Estimate how many bytes your page's HTML, inline CSS and inline JavaScript would save if minified, with the saving shown separately for each.
What it does not do: It estimates savings for inline styles, inline scripts and the HTML itself; external CSS and JavaScript files are not downloaded, and server compression is not measured.
What It Does
Scans the inline `<style>` blocks, inline `<script>` blocks, and raw HTML markup on the page for extra whitespace and comments, then estimates how much smaller each would be if minified. Returns an estimated byte saving for HTML, CSS, and JS separately.
Why It Matters
Unminified code is larger than it needs to be: the browser downloads the same instructions plus spaces and comments. Inline <style> and <script> blocks added by a CMS or page builder are easy to miss because they never pass through a build step. Smaller render-blocking CSS can help the page start rendering sooner.
How It Works
-
Enter a page URL or paste its HTML
-
We scan the inline `<style>` and `<script>` blocks in the page HTML
-
Analyze byte-level whitespace and comment density in each block
-
Return pass/fail status for HTML, CSS, and JS with an estimated KB saving
Sample input + output
pasted HTML: a 994-byte sale page
<style> /* Hero banner */ .hero { padding: 48px 24px; … } </style>
<script> // Countdown to the end of the sale … </script>
<link rel="stylesheet" href="/assets/theme.css">
<script src="/assets/app.js" defer></script> Score: 35/100 — Significant minification savings available. Original size: 994 B Estimated minified: 735 B Potential saving: 26.1% Failed: HTML whitespace is minified Failed: Inline CSS is minified Failed: Inline JavaScript is minified Needs attention: No comments left in the served code Where the savings are: HTML whitespace and comments — 93 B Inline CSS (blocks: 1) — 88 B Inline JavaScript (blocks: 1) — 78 B External CSS/JS files: 2 — not downloaded, so not counted here
How to read the result
- Score (35) and headline
- A summary of how much of the page's code is spaces, line breaks and comments. In the sample, 35 and "Significant minification savings available" mean that about a quarter of the markup could go.
- Original size and estimated minified (994 B → 735 B)
- The size of the HTML you pasted or we fetched, and an estimate of the same HTML once whitespace and comments are removed from the markup, the inline CSS and the inline JavaScript. It is a cautious estimate made with simple rules, not the output of a real minifier, and it is measured before your server compresses the response.
- Potential saving (26.1%)
- The difference as a share of the page. Below 8% the page counts as well minified; above 20% the headline calls the saving significant.
- The four checks
- HTML fails when its whitespace and comments make up 5% or more of the page; inline CSS and inline JavaScript fail when 10% or more of their own blocks could go. Comments only get a warning, because some, such as licence notices, are kept on purpose. JSON-LD and other data blocks are skipped.
- Where the savings are
- The bytes each part would save. In the sample: 93 B of HTML whitespace and comments, 88 B in the one inline <style> block and 78 B in the one inline <script> block. Start with the largest line.
- External CSS/JS files (2)
- Stylesheets and scripts loaded from separate files are counted but not downloaded, so their size is not in these figures. On most sites they are the bigger part: check them in the Network tab of your browser's developer tools.
Who Uses This
-
Performance Engineer
Before a big sales day, check the inline code on key pages; every kilobyte counts on slow mobile connections.
-
Frontend Developer
Confirm any inline `<style>` or `<script>` your page builder injects is actually minified — catch the day a CMS export starts shipping raw, unminified blocks.
-
DevOps Engineer
Re-check the page after every deploy — catch the day a CMS update starts shipping unminified inline blocks again.
Common problems and how to fix them
-
Inline CSS from a theme or page builder
Move the CSS into the stylesheet your build already minifies, or turn on CSS minification in your optimisation or caching plugin. Small critical CSS that has to stay inline can be minified once and pasted in that form.
<style>.hero{padding:48px 24px;background-color:#0ea5a4;color:#fff}.hero h1{font-size:2.5rem;margin:0 0 16px}</style> -
Hand-written inline scripts
Move the script into a file your build tool minifies and load it with defer. If it has to stay inline, run it through a minifier before pasting it into the template.
-
Comments shipped to visitors
Strip comments in the build step and keep only those a licence requires; most minifiers keep comments that start with /*! for exactly that reason.
-
HTML full of indentation and blank lines
Turn on HTML minification in your CMS cache or static site generator, and let the server compress responses with Brotli or gzip. Compression removes most of the cost of whitespace, so if you can do only one of the two, do that first.
# nginx: HTML is compressed once gzip is on gzip on; gzip_types text/css application/javascript application/json image/svg+xml; -
Minified, but the page is still heavy
Minification only trims the code you already ship. Large external files usually matter more: remove CSS and JavaScript the page does not use, and defer scripts the first screen does not need.
Frequently Asked Questions
- What's a typical size reduction?
- It depends on how the code was written. Minification removes whitespace and comments; compression with gzip or Brotli, usually handled by your web server, saves more on top. Minify first, then let the server compress.
- Does minification affect SEO?
- Indirectly. Smaller files can make the page render sooner, which helps Core Web Vitals. Core Web Vitals are one of many signals Google uses, not a guaranteed ranking boost.
- What about source maps?
- Browsers download source maps only when someone opens the developer tools, so they do not slow the page. Publishing them makes your original source readable to anyone, so decide whether that is acceptable.
- What about third-party scripts I don't control?
- You can't minify them — but you can self-host the latest minified version, use `defer`, or remove non-essential third-parties.
- Should I minify HTML too?
- It helps a little. HTML compresses well, so the saving after compression is usually small, but it costs nothing if your CMS or build step supports it.
Sources
The documentation this tool and the explanations on this page are based on.
- Minify CSS — Chrome for Developers (Lighthouse)
- Minify JavaScript — Chrome for Developers (Lighthouse)
- Minification — MDN Web Docs
- Compression in HTTP — MDN Web Docs