HTML Formatter & Minifier
Indent HTML so it reads well, or minify it without changing how it renders.
Formatted HTML
Examples
Questions
Can minifying change how my page looks?
It should not. Runs of spaces become one space, which is how browsers show them anyway, and spaces next to block tags like <div> and <p> are removed because they never show. Spaces between inline tags like <a> and <b> are kept.
What does minify leave alone?
The contents of <pre>, <textarea>, <script> and <style> are copied exactly, since whitespace matters there. Conditional comments for old Internet Explorer are kept too.
Why is some markup kept on one line when beautifying?
Inline elements like <a>, <b> and <span> stay on the line with their text. Breaking them onto new lines would add visible spaces.
Does it fix broken HTML?
No. It formats what you paste, so an unclosed tag stays unclosed. Browsers are forgiving about HTML, so there is no single right way to fix it.
Related tools
- CSS Minifier & BeautifierMinify CSS, or format minified CSS with indentation.
- JS Minifier & BeautifierMinify JavaScript with Terser, or format minified code with indentation.
- HTML Entity Encoder & DecoderEscape HTML special characters, or decode entities back to text.
- XML Formatter & ValidatorFormat, minify and check XML, with errors shown by line and column.
- Markdown to HTMLPreview Markdown as you type and copy the HTML, with tables and task lists.