Strip comments & whitespace from CSS, JS or HTML
A tool that strips comments and collapses extra whitespace from CSS, JavaScript, or HTML, shrinking the file size without changing what the code does — paste code in, get a smaller version out, with the size reduction shown instantly.
Pick CSS, JavaScript, or HTML.
Paste your source code.
Click Minify, then copy the result.
Comments (line and block, or HTML comments) and unnecessary whitespace — extra spaces, tabs, and
line breaks left in for human readability. For CSS, spacing around structural punctuation like
{ } : ; , is also tightened.
No. Dedicated minifiers like Terser (JS) or cssnano (CSS) also rename variables to shorter names, remove dead code, and apply deeper syntax-level optimizations, which get much larger size reductions. This tool only removes comments and collapses whitespace — simpler, safer to reason about, but a smaller win.
content: " : "; can lose the spacing inside the quotes during minification. If your CSS has
quoted values where spacing matters (like generated content strings), check the output carefully before
using it.
<pre>
tags (where line breaks and spacing are meaningful) and inside inline <script> tags
(where it can alter string literals). Avoid minifying HTML that contains either, or review the output
closely if you do.
The core stripping pass tracks whether it's inside a string, template literal, line comment, or block
comment character by character, so a // or /* sitting inside a quoted string
in your JS or CSS won't be mistaken for a real comment and accidentally eaten.
Original Size and Minified Size are measured in real UTF-8 bytes, not just character count, and Reduction shows the percentage saved — heavily commented, deeply indented code shows a bigger number here than code that was already fairly compact.
Smaller CSS/JS files download and parse faster for site visitors.
Fit code into a form field or config value with a character limit.
Comment and whitespace removal makes code slightly less readable at a glance, though not truly obfuscated.
No. This tool only strips comments and collapses whitespace. It doesn't rename variables, shorten property names, remove dead code, or do any of the deeper optimizations a dedicated tool like Terser (JS) or cssnano (CSS) performs, so the size reduction is smaller than those tools would achieve.
Yes, this is a known issue. The final punctuation-tightening pass isn't aware of quoted strings, so CSS like content: " : "; can lose the internal spacing inside the quotes. Check generated content values after minifying.
No, this is a known issue. Whitespace collapsing applies to the whole document, including inside <pre> (where line breaks and spacing are meaningful) and inside inline <script> content (where it can even alter string literals). Avoid minifying HTML that contains either.
No. Minification runs entirely in your browser using JavaScript. Nothing you paste here is uploaded anywhere.
It depends heavily on how many comments and how much formatting whitespace the original code has. Heavily commented, indented code shrinks more; already-compact code shrinks little.
For CSS without quoted strings containing intentional spacing, and for JavaScript, generally yes. For HTML containing <pre> or inline <script> tags, review the output carefully first given the known whitespace issue above.