HTML Formatter
Format and indent HTML documents and snippets, including embedded CSS and JavaScript, using Prettier.
What is the HTML Formatter?
Formatted HTML makes nesting clear and diffs smaller.
How does it work?
Prettier parses the HTML (and any <style> and <script> blocks) and prints it with consistent indentation and line length. The formatter is loaded only when you open this page.
Example
A minified page becomes a readable tree with each element on its own line.
Frequently asked questions
Is my data sent to a server?
No. This tool runs entirely in your browser; nothing you paste is uploaded or stored.
Why did whitespace inside an element change?
HTML treats whitespace as significant only in some contexts. Prettier follows CSS display rules to keep rendering identical.
Related tools
Enable JavaScript to use this calculator.