How to use the HTML Formatter
- Paste HTML or open an .html file.
- Choose line width and indentation.
- Copy or download the formatted markup.
How it formats
The formatter uses Prettier, the same tool many teams run in their editors. It parses the HTML (including inline <style> and <script>), then prints it with consistent indentation and wrapping. Because it parses first, badly broken markup produces an error with its location rather than mangled output.
Whitespace is respected
In HTML, spaces between inline elements can be visible. The formatter follows CSS display rules, so it won't add or remove spaces that would change how text renders — which is why some lines may look oddly broken around inline tags.
Preview safely
The formatter never executes your HTML. To see what a page looks like, use the HTML viewer, which renders it in a sandbox with scripts disabled.
Frequently asked questions
Can it minify HTML?
Not currently. Safe HTML minification has to respect whitespace-sensitive elements like <pre> and inline text, and we'd rather not offer a minifier that can subtly change your page.
Does it work with templates (JSX, Vue, Handlebars)?
Plain HTML only. Template syntax may cause parse errors.
Is what I enter stored or sent anywhere?
No. Calculations and processing happen in your browser. Nothing you type is sent to our servers. Some tools remember your last input in this browser's local storage for convenience; you can clear it at any time.