Indents HTML tags, CSS rules and JavaScript blocks, puts one statement or declaration on each line, and lets you choose 2 spaces, 4 spaces or tabs.
Developer
HTML, CSS & JavaScript Formatter
Make minified or messy HTML, CSS and JavaScript readable, or shrink readable code for production. Broken code is reported with its line, not quietly reshaped.
How to use this tool
Choose the Language, HTML, CSS or JavaScript, then paste or drop the code.
Choose Beautify to make it readable with your Indent, or Minify to make it as small as it safely can be. JavaScript and CSS are checked first, so a mistake is named with its line and column.
Compare the sizes below, then press Copy result or Download. If a note says the code looks like another language, change the Language above.
How to use this tool
Choose the Language, HTML, CSS or JavaScript, then paste or drop the code.
Choose Beautify to make it readable with your Indent, or Minify to make it as small as it safely can be. JavaScript and CSS are checked first, so a mistake is named with its line and column.
Compare the sizes below, then press Copy result or Download. If a note says the code looks like another language, change the Language above.
Paste some code and choose its language, or load the sample.
Readable when you write it, small when you ship it.
Beautify turns a single minified line into indented code you can read and edit. Minify does the reverse, removing everything a browser does not need.
JavaScript is compressed with a real parser that shortens local names and removes dead code. CSS is merged and shortened. HTML loses comments and extra white space, but never a space that is shown.
JavaScript is parsed first, so a syntax error is named with its line and column. Unclosed CSS brackets, strings and comments are reported too.
Frequently asked questions
Is minified code safe to use?
It should behave exactly like the original, but test it. JavaScript minifying renames variables inside functions and removes unreachable code. Names used from outside, such as functions called by an onclick attribute, are kept.
Why is the HTML not shortened as much as with other tools?
This minifier only removes what cannot change how the page looks: comments and extra white space. Text inside pre, textarea, script and style is left alone, and the space between two inline tags is kept because it is shown.
Does it work with modern JavaScript?
Yes. Arrow functions, classes, async and await, template strings and import and export are all understood. Code with import or export is treated as a module.
Can it fix my broken code?
No. It tells you where the problem is so you can fix it. Beautifying code that does not parse would only make the mistake harder to see.
Why does the tool say my code looks like a different language?
It looks at what you pasted. If you pasted CSS while HTML is chosen, the result would be wrong, so it points that out. Choose the right language above.
