HTML, CSS and JavaScript beautifier

Paste HTML, CSS or JavaScript to re-indent it neatly, for example to read minified code from a website. Choose Minify to shrink HTML or CSS.

Loading beautifier…

What the beautifier does

Formatting changes whitespace only, so the code behaves exactly as before. It uses the open-source js-beautify library, running in your browser.

Minify

CSS minify removes comments and every space that is not needed. HTML minify removes comments and collapses runs of whitespace to a single space, keeping <pre>, <textarea>, scripts and styles exactly as they are, so the page looks the same. JavaScript minify is not offered: shrinking JavaScript safely needs a full parser, so use a build tool such as esbuild or terser.

Frequently asked questions

How do I make minified JavaScript readable?
Choose JavaScript and Beautify, then paste the code. Variable names shortened by the minifier stay short, but the structure becomes easy to follow.
Will formatting break my code?
No. Only whitespace and line breaks change. One exception to watch: in HTML, whitespace inside inline content can matter, which is why inline elements are kept on the same line.
Can I set the indentation?
Yes: 2 spaces, 4 spaces or tabs.
Is my code uploaded?
No. It is formatted in your browser.