Developer tool

CSS, JavaScript, and HTML Minifier

CSS, JavaScript and HTML minifier: remove comments and extra whitespace from code snippets while keeping strings intact. Review the output. Nothing is uploaded.

Your file never leaves your device.

This is conservative formatting cleanup, not a production compiler. Review and test output.

Runs locally in your browser

Your text is not uploaded.

Simple steps

How it works

  1. 01

    Paste a CSS, JavaScript, or HTML snippet.

  2. 02

    Choose the language for conservative whitespace and comment cleanup.

  3. 03

    Copy the smaller output and review it before use.

What minification removes

For CSS, the tool removes comments and the spaces around { } : ; and commas, so .a { color: red; } becomes .a{color:red;}. Spaces that matter, such as in calc(100% - 2rem) or between selectors, are kept. For HTML, it removes comments and shortens runs of spaces; space between tags becomes a single space, because between inline elements such as <b> and <i> it is a visible word space. The content of script, style, pre and textarea elements is left exactly as it is.

For JavaScript, it removes comments and spacing while keeping strings, template literals and regular expressions unchanged.

Line breaks in JavaScript

JavaScript can end a statement at a line break when there is no semicolon. The minifier therefore keeps a line break wherever it could end a statement, and removes it only where that is impossible, for example after { or a comma. Code written without semicolons stays correct, and code with semicolons comes out on fewer lines.

What it does not do

It does not rename variables, remove unused code or rewrite expressions, so the savings are smaller than with a build tool such as esbuild, Terser or cssnano. It is meant for quick clean-ups of snippets. Test minified code before using it in production, and keep the readable original for editing.

Good to know

Frequently asked questions

Which languages are supported?

Choose CSS, JavaScript, or HTML.

Does this perform advanced code optimization?

No. It applies conservative comment and whitespace cleanup; it does not rename symbols or optimize program logic.

Should I test the output?

Yes. Review and test minified code in your project, especially scripts with unusual syntax or embedded content.

Can minification change strings?

The tool preserves quoted strings and template literals while reducing safe whitespace around them.

Is code uploaded?

No. Minification runs locally in your browser.