Code Minifier

Strip whitespace, comments and redundant characters from HTML, CSS and JavaScript to make your code smaller. No uploads — runs in your browser.

Source code

Minified output

Minified code will appear here.

Private by design. Minification happens in JavaScript inside your browser. Nothing you paste is sent anywhere.

How the minifier works

JavaScript

Single-line and multi-line comments are removed. Sequences of whitespace are collapsed. Newlines inside strings are preserved. This is a whitespace-removal pass — it does not rename variables or reorder code, which is a job for a full bundler like Terser or esbuild.

CSS

Comments are stripped, unnecessary whitespace is collapsed, and trailing semicolons in the last declaration of each rule are removed. CSS is otherwise left structurally intact — selector and property names are preserved as-is.

HTML

Comments are removed and sequences of whitespace (including newlines) between tags are collapsed to single spaces. Attribute values and text content are preserved. This is a conservative pass: it does not remove optional tags or collapse boolean attributes, which could change semantics.

How to use the Code Minifier

  1. Paste your HTML, CSS or JavaScript.
  2. Choose whether to strip comments and optional semicolons.
  3. Copy the minified output.

Frequently asked questions

Which languages can it minify?

HTML, CSS and JavaScript.

Will minifying break my code?

Whitespace removal is generally safe, but take care where spacing is significant; keep a readable copy.

Does my code leave my browser?

No. Minification runs locally, so your code is never uploaded.