Code Minifier

Strip whitespace, line breaks and comments from HTML, CSS and JavaScript.

Minify HTML, CSS and JavaScript to Cut Page Weight

Minification removes everything a browser does not need in order to execute your code: comments written for humans, indentation, line breaks and redundant spacing. The behaviour is identical; the file is simply smaller. On a typical stylesheet the saving is 20–35% before gzip, and gzip compresses the minified result further still.

This minifier handles all three front-end languages with language-aware rules — it understands that a // inside a string is not a comment, that CSS needs a space preserved between selector combinators, and that HTML whitespace is significant inside <pre> and <textarea> elements.

Key features

  • Three languages — HTML, CSS and JavaScript, each with rules appropriate to its syntax.
  • String-aware — comment stripping never damages a comment-like sequence inside a quoted string or regular expression.
  • Live savings readout — original size, minified size and the exact percentage reduction.
  • Safe defaults — the minifier does not rename variables or reorder statements, so behaviour is never changed.
100% client-side — no data leaves your machine

This tool runs entirely inside your browser using native Web APIs. Your files and text are never uploaded to a server, never logged and never shared with third parties.

How to use: Code Minifier

  1. Select the language
    Choose HTML, CSS or JavaScript so the right comment and whitespace rules are applied.
  2. Paste your source code
    Drop in the full file contents. Formatting and comments are welcome — that is exactly what gets removed.
  3. Minify
    The output pane fills immediately and reports the size before and after along with the percentage saved.
  4. Copy into your build
    Copy the minified output to your clipboard and save it as your production asset.

Technical specifications

Processing locationEntirely in your browser — no server round trip
Data uploadedNone. Files and text never leave your device
PriceFree — no account, no trial, no usage cap
CategoryDeveloper
Works offlineYes, once the page has loaded
Browser supportChrome 90+, Edge 90+, Firefox 90+, Safari 15+
Interface languagesEnglish, 中文, हिन्दी, Español, العربية

Frequently asked questions

Does minifying break my code?

It should not. This minifier only removes comments and insignificant whitespace — it never renames identifiers, removes dead code or reorders statements. Always test the minified output before deploying, as you would with any build step.

How much smaller will my files get?

Heavily commented and indented source often drops 30–40%. Already-compact code may only shrink 10%. Combining minification with gzip or Brotli on your server gives the biggest total win.

Should I minify if my server already uses gzip?

Yes. They work on different redundancies and compound: gzip compresses a minified file to a smaller size than it compresses the original, because there is less to compress in the first place.

Can I un-minify code?

You can re-indent it to make it readable again, but comments and original variable names are gone permanently. Always keep your unminified source under version control.

Related tools

Back to all tools