HTML, CSS & JavaScript Minifier
Shrink your code so your site loads faster. Pick the language, paste the code and get a minified version instantly, with the percentage saved. JavaScript is minified with Terser, the same engine webpack and Vite use. Nothing is uploaded to a server.
How to minify HTML, CSS or JavaScript
- Pick the language: HTML, CSS or JavaScript.
- Paste your code into the left panel.
- Click "Minify". You will see the original size, the final size and the percentage saved.
- Copy the result or download it as a production-ready .html, .css or .js file.
Why minify your website code?
Minification removes everything the browser doesn't need to run your code: comments, spaces, line breaks and, in JavaScript, long variable names. The result behaves exactly the same but is much smaller, which cuts download time and improves metrics such as LCP and FCP that Google uses to rank pages.
For HTML, whitespace between tags is collapsed while the contents of pre, textarea, script and style are preserved. For CSS, comments, whitespace and the last semicolon of each block are removed without touching strings or url(). For JavaScript, Terser parses the code and applies safe compression and local variable mangling.
Frequently asked questions
Can minification break my code?
Not for valid CSS and JavaScript: JS is minified with Terser, which parses the code before transforming it and never changes its behavior. If the code has a syntax error, the tool reports it instead of producing broken output.
What is the difference between minifying and compressing (gzip/brotli)?
They complement each other. Minification removes unnecessary characters from the source; gzip or brotli compress the file during transfer. Using both gives the smallest possible size.
Are license comments kept?
Yes, if you enable "Keep license comments". Comments starting with /*! are preserved, as many open-source licenses require.
Is my code sent to a server?
No. Everything is processed in your browser, so you can minify private code with peace of mind.