CSS Formatter
Beautifies CSS with one declaration per line and consistent indentation.
Clean up messy or minified HTML with consistent indentation, one element per line, and tidy attributes. Inline scripts and styles are formatted too.
.html file.The HTML is re-indented by js-beautify, a formatter used in many code editors. It reads the markup as tokens, so it works on fragments and on HTML with small mistakes.
<div>, <ul>, and <section> start new lines and indent their children.<a>, <strong>, and <span> stay in the flow of the text, so no visible spaces are added.<script> and <style> are formatted as JavaScript and CSS.<pre>, <textarea>, and comments are copied as they are, because whitespace in them is visible.Input:
<ul class="nav"><li><a href="/">Home</a></li><li><a href="/blog">Blog</a></li></ul>
Formatted with 2 spaces:
<ul class="nav"> <li><a href="/">Home</a></li> <li><a href="/blog">Blog</a></li> </ul>
Almost never. Only whitespace between tags changes, and browsers collapse that whitespace. Content inside <pre> and <textarea> is never touched.
No, this tool only beautifies. To shrink the CSS and JavaScript of a page, use the CSS Minifier and the JavaScript Minifier.
No. It re-indents what is there. Unclosed tags stay unclosed, although the indentation often makes them easy to spot.
No. Formatting runs in your browser.
Often used together with the HTML Formatter.
Beautifies CSS with one declaration per line and consistent indentation.
Beautifies minified or messy JavaScript with your chosen indent and brace style.
Beautifies XML with clean indentation or minifies it to one line.