Skip to content

← All tools

Code Minifier & Beautifier

Minify HTML, CSS or JavaScript for a quick size cut — or beautify minified code so you can read it. Correctness-first (strings and pre blocks are never touched), with byte savings shown. Everything runs in your browser.

New to this? Read the Code Minifier & Beautifier guide →

Language
Mode

Deliberately conservative

This tool is correctness-first. CSS minification strips comments and every removable space — close to what build tools achieve. HTML minification removes comments and inter-tag whitespace while leaving <pre>, <textarea>, <script> and <style> content untouched. JavaScript minification strips comments and indentation but keeps line breaks — removing them safely requires a full parser because of semicolon insertion, and renaming variables is a build-tool job. If you need maximum JS compression, use a bundler (esbuild, terser) in your build; if you need a quick, safe size cut for a snippet, this is that.

Beautify goes the other way: re-indenting minified or messy code so you can read it — vendor snippets, code from a bug report, the contents of someone's inline script tag. Byte counts before/after are shown for every minify. Everything runs locally; see the guide for what minification actually buys once gzip is involved.

Where you'd use this

Shipping less to the browser, and reading what someone else shipped. Minifying trims bytes off a page; beautifying makes a vendor bundle legible enough to debug.

For example: A landing page loads a 48KB inline stylesheet. Minifying takes it to 31KB — a third off the render-blocking payload, which shows up directly in Largest Contentful Paint.

Frequently asked questions

How much smaller does minification make my code?

Stripping comments and whitespace typically saves 10–30% on hand-written code. After the server compresses the file with gzip or Brotli the visible gap shrinks, but the savings still stack — and the browser parses fewer bytes either way.

Why does the JavaScript minifier keep line breaks?

Removing newlines safely requires a full parser because of JavaScript’s automatic semicolon insertion — a line-break removal that looks harmless can change behaviour. This tool is correctness-first: comments and indentation go, structure stays. For maximum compression use a build tool like esbuild or terser.

Will minifying HTML break my <pre> blocks or inline scripts?

No. pre, textarea, script and style contents are protected and passed through byte-for-byte; only comments and whitespace between tags are collapsed.

Is my code uploaded?

No. Minifying and beautifying are pure text processing running locally in your browser.

Related tools