Zokilos

Code Minifier

Strip comments & whitespace from CSS, JS or HTML

Original Size
Minified Size
Reduction

What Is This Code Minifier?

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.

How to Minify CSS, JavaScript, or HTML

1

Pick CSS, JavaScript, or HTML.

2

Paste your source code.

3

Click Minify, then copy the result.

What Minification Actually Removes

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.

Is This a Full Minifier Like Terser or UglifyJS?

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.

Important: A Known Issue With CSS Quoted Strings

The CSS mode's final spacing-tightening pass isn't aware of quoted string content. CSS like 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.

Important: HTML Minification and Pre/Script Content

Whitespace collapsing in HTML mode applies to the entire document, including inside <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.

Why It's String- and Comment-Aware

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.

Understanding the Size Reduction Stats

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.

What This Tool Doesn't Do

  • No variable or property renaming
  • No dead code removal or syntax-level optimization
  • No source maps for debugging minified output
  • No batch processing of multiple files

When to Use Minified Code

🚀

Shipping to production

Smaller CSS/JS files download and parse faster for site visitors.

📋

Pasting into size-limited fields

Fit code into a form field or config value with a character limit.

🔒

Light obfuscation

Comment and whitespace removal makes code slightly less readable at a glance, though not truly obfuscated.

Limitations

  • CSS mode can mangle spacing inside quoted string values
  • HTML mode doesn't protect <pre> or <script> content
  • No variable renaming or dead-code elimination, smaller gains than a full minifier

Benefits of Using This Tool

  • String- and comment-aware stripping, not a naive regex pass
  • Instant before/after size comparison
  • Runs entirely in your browser — nothing uploaded to a server
  • Free, with no sign-up required

Frequently Asked Questions

Does this rename variables or shrink code like Terser or UglifyJS?

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.

Can the CSS minifier break quoted string content?

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.

Does the HTML minifier preserve whitespace inside <pre> and <script> tags?

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.

Is my code sent to a server when I minify it?

No. Minification runs entirely in your browser using JavaScript. Nothing you paste here is uploaded anywhere.

How much size reduction can I expect?

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.

Is minified code from this tool safe to use in production?

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.