Minified CSS in
Beautifying body{color:red;margin:0} with a 2-space indent produces "body { color: red; margin: 0; }" laid out one declaration per line.
Beautify and format JavaScript, HTML and CSS code online with clean indentation — free.
About
Automatically reformats messy JavaScript, HTML or CSS with consistent indentation, using js-beautify — a small, well-known formatting library loaded from this site the first time you use it — but the formatting itself runs entirely in your browser.
Developers use it to tidy up minified or inconsistently indented code, while students use it to see what properly formatted code looks like. It's one of many free developer tools on Toolapt, and like every tool here, it's free to use with no sign-up and no limit on how many times you run it.
Examples
3 worked examples
Beautifying body{color:red;margin:0} with a 2-space indent produces "body { color: red; margin: 0; }" laid out one declaration per line.
Beautifying function add(a,b){return a+b;} produces "function add(a, b) { return a + b; }" with braces and spacing normalized.
Beautifying <div><p>Hi</p></div> produces the div and p tags on separate lines, with the p indented one level inside the div.
FAQ
Quick answers to common questions about the Code Beautifier.
It automatically reformats messy JavaScript, HTML or CSS with consistent indentation, using a real code-formatting library.
Yes. It's free, with no sign-up, no watermark and no limit on how many times you use it.
Yes. Your code is formatted entirely on your own device. A small formatting library (js-beautify) is loaded from this site the first time you use each language, but your code itself is never uploaded.
JavaScript, HTML and CSS.
Yes. Set any indent size from 1 to 8 spaces before beautifying.
Reliable code formatting needs a real parser for each language — building that from scratch wouldn't be as accurate as js-beautify, the same library many editors and build tools already use.
Yes. The page is fully responsive and works on mobile, tablet and desktop browsers alike.
It formats one language at a time; mixed-language files (like HTML with embedded JavaScript) are formatted as HTML, not split apart.
Did Code Beautifier work for you?