HTML formatter
Paste messy or one-line HTML to get neatly indented, readable code; CSS inside style tags and JavaScript inside script tags are formatted too.
How to format HTML
- Paste HTML on the left or open an .html file.
- Pick the indent (2 or 4 spaces, or tabs) and the line width.
- Copy or download the formatted file.
Frequently asked questions
Yes. CSS inside style tags and JavaScript inside script tags are each formatted in their own style.
Hardly: it only adds or removes spaces and line breaks where that is safe. Spaces between words in a paragraph are kept so text does not join up or split differently.
Usually a closing tag does not match the opening one, such as a div closed with a closing span. The message gives the line and column so you can find it.
It reads plain HTML. Special syntax like {{ }} is kept as it is, but PHP files or templates mixing several languages may report an error.
It is completely free and needs no sign-up.
Related tools
CSS formatterBeautify CSS, SCSS and Less codeJavaScript formatterBeautify JavaScript, JSX and TypeScript codeMarkdown previewType Markdown, preview it live and get the HTMLSQL formatterMake SQL queries easy to readURL parserSplit a link into parts and edit its queryUser-Agent parserFind browser, OS and device from a user agentCIDR CalculatorNetwork details of an IPv4 or IPv6 CIDR blockSubnet CalculatorSplit an IPv4 network into subnets, VLSM tooMIME Type LookupLook up MIME types and check a file's real type