Skip to content
toola.

HTML · CSS · JS

HTML, CSS and JavaScript minifier

Paste or open HTML, CSS or JavaScript and get a smaller file with the original and minified sizes side by side. HTML and CSS lose only comments and whitespace that can’t change the result; JavaScript is minified with Terser, which also shortens local names and removes dead code.

Private: your files never leave your device.

Language

HTML and CSS: comments and needless whitespace are removed, nothing else, so the page looks the same. JavaScript: Terser renames local variables and removes dead code; test the result before shipping it.

How was this tool?

How to use HTML, CSS & JavaScript minifier

  1. Step 1: Pick HTML, CSS or JavaScript.

  2. Step 2: Paste the code or open a file, then press Minify.

  3. Step 3: Check the size saved, then copy or download the result.

What is removed

LanguageRemovedKept
HTMLcomments, repeated spaces and line breaksone space between tags, <pre>, <textarea>, <script>, conditional comments
CSScomments, spaces around { } ; : , >, the last ;spaces in selectors (a :hover), between values, inside calc(), strings, /*! licence */ comments
JavaScriptcomments, whitespace, dead code; local names shortened (Terser)/*! … */, @license and @preserve comments; global names

Minified code is much smaller before compression; once a server gzips or brotli-compresses it, the difference shrinks, but it still saves download and parse time.

Frequently asked questions

Will minified HTML look different?

It shouldn’t: whitespace between tags is reduced to one space rather than removed, because it can be visible between inline elements, and <pre>, <textarea> and <script> are left exactly as they are.

Is minified JavaScript safe to deploy?

Terser is used by most build tools and keeps behaviour the same for valid code, but test the result: code that relies on function names (for example some dependency injection) can be affected by renaming.

Should I minify by hand?

For a one-off file or a snippet, yes. For a site you update often, let your build tool (Vite, webpack, esbuild…) minify on every build.