Skip to content

HTML / CSS / JS minifier. Safe transforms only.

Language auto-detects when you paste
Load file: drop or click

Your code never leaves your browser. Nothing is uploaded.


- before → - after 0% saved
§ · written guide

How to use the HTML / CSS / JS Minifier

This minifier makes HTML, CSS and JavaScript smaller by removing comments and extra whitespace, and in CSS by shortening hex colors. It only makes conservative changes and never renames variables or rewrites logic. Use it for one-off files, snippets for a CMS or an email, or to see how much a file could shrink.

Step by step

  1. Add your code

    Paste into the Input box, or use Load file to drop or pick a .html, .css or .js file of up to 10 MB. Load sample fills the box with an example in the current language.

  2. Check the language

    The HTML, CSS and JavaScript buttons set the language, and HTML is selected when the page opens. The tool guesses the language when you paste, and a loaded file's extension wins. If the guess is wrong, press the right button.

  3. Choose the options

    Each language has its own checkboxes. HTML: Strip comments, Collapse inter-tag whitespace and Trim attribute quotes (off by default). CSS: Strip comments, Shorten hex colors and Remove last semicolons. JavaScript: Strip comments, Keep /*! license comments, Remove blank lines and Trim trailing spaces.

  4. Minify

    The Minified output updates a moment after you stop typing. Press Minify to run it on demand and see a note with the bytes saved.

  5. Copy or download

    Press Copy to put the result on your clipboard, or Download to save it as minified.html, minified.css or minified.js. Clear empties both boxes.

Reading the result

  • The line under the boxes shows the size before, the size after and the % saved, with a bar that fills to match. Sizes are bytes as the file would be saved, so a character such as é counts as 2.
  • HTML keeps the contents of pre, textarea, script and style blocks exactly as they were, and keeps conditional comments such as [if IE].
  • CSS always keeps comments that start with /*!, the usual way to mark a license. Hex colors are only shortened when no detail is lost, so #aabbcc becomes #abc.
  • JavaScript output keeps your line breaks and indentation. Only comments, blank lines and trailing spaces are removed, so savings are smaller than a build tool would give.

Tips and common mistakes

  • Keep your original file. Minified code is hard to read, so always edit the source and minify again.
  • Inline CSS and JavaScript inside an HTML file are not minified, because style and script blocks are left untouched. Minify large blocks separately on the CSS or JavaScript setting.
  • Trim attribute quotes only removes quotes around simple values like class=card. It is valid HTML5, but some older tools expect quotes, which is why it starts off.
  • For full JavaScript minification with renaming and dead code removal, use a build tool such as esbuild or terser.
  • Test the minified file on a real page before you replace the original.

Privacy and limits

All minification runs in your browser with code built into the page. Your code is not uploaded and nothing is saved. Files are read on your device, with a limit of 10 MB per file.

Back to the tool

§ 02 · what you can do

Everything a minifier should do.

Minify HTMLStrip comments and collapse inter-tag whitespace in one click, conditional [if IE] comments and pre/textarea/script blocks stay intact.
Minify CSSRemove comments (keeping /*! licenses), strip last semicolons and shorten six-digit hex colors to three where it's lossless.
Minify JavaScript, safelyA string- and regex-aware tokenizer removes comments and blank lines. Variables are never renamed, so behavior can't break.
See live size savingsA before/after byte readout and a progress bar show exactly how much you've saved, updating as you type.
Load any fileDrop or pick a .html, .css or .js file (up to 10 MB), the language is detected automatically.
Copy or downloadGrab the minified output to your clipboard or download it with the right file extension, no account, nothing uploaded.
§ 04 · faq

Frequently asked questions.

Is the minifier free and private?
Yes on both counts. It's completely free with no sign-up or limits, and it runs entirely in your browser, your HTML, CSS and JavaScript never leave your device and nothing is uploaded to a server.
Will minifying my JavaScript break it?
No. JavaScript minification here is safe-only: a string- and regex-aware tokenizer removes comments and blank lines, but variables are never renamed and code structure is left untouched, so behavior can't change. For aggressive AST-level minification (renaming, mangling, tree-shaking) use a build tool such as esbuild or terser.
Does it strip license comments and conditional HTML?
By default it preserves what you'd want to keep. CSS and JavaScript /*! license comments are retained, and HTML conditional comments like <!--[if IE]> are left in place. Contents of pre, textarea, script and style blocks are never touched.
How does auto-detect know the language?
When you paste, it inspects the first characters and structure, a doctype or a leading tag reads as HTML, an @media/@import rule or selector-with-declarations block reads as CSS, and anything else falls back to JavaScript. When you load a file, the file extension wins. If it ever guesses wrong, just switch the language toggle.
Does it work offline?
Yes. Once the page has loaded, all minification runs locally, so it keeps working with no connection, no libraries are fetched at run time.

Published · Last updated .

Priya sent you a message Online now

Talk to a Developer Now

Share your name and email to reply.

Reply