HTML, CSS and JavaScript minifier
Make HTML, CSS and JavaScript smaller by removing comments and extra whitespace, and see how many bytes you saved. It's deliberately conservative: strings, pre blocks and line breaks in JavaScript are kept, so the code behaves the same.
How to use the HTML, CSS & JS Minifier
- 1Choose HTML, CSS or JavaScript.
- 2Paste your code. It's minified as you type.
- 3Read any warning, such as an unclosed string or a missing brace.
- 4Copy or download the result, and test it before you publish.
Frequently asked questions
Is it safe to minify my code here?
Yes. The minifier only removes comments and whitespace. It never renames variables or rewrites code, and it keeps strings, url() values, pre and textarea content and conditional comments exactly as they are.
Why are line breaks kept in minified JavaScript?
JavaScript can add semicolons automatically at line breaks, so removing them can change how code runs. Basic mode keeps them for safety. For maximum compression, use a build tool like esbuild or Terser.
How much smaller will my files get?
Usually 10–30% for hand-written HTML and CSS, depending on how many comments and indents there are. With gzip or Brotli on your server, the transferred size drops much further.
Related free tools
All toolsThen schedule it with Join Postly
Plan, publish and track your posts on every network from one calendar. Free plan, no credit card.