HTML Formatter
Beautify messy or minified HTML into clean, indented markup using Prettier, right in your browser.
About the HTML Formatter
Minified or hand-edited HTML is hard to read and review. The HTML Formatter re-indents markup with Prettier so nesting is obvious, without changing what the page renders.
Everything runs in your browser, so your input is never uploaded to a server.
How to use the HTML Formatter
- Paste HTML or open an .html file.
- Choose the indentation and the line width at which long lines wrap.
- Copy or download the formatted markup.
Frequently asked questions
Will formatting change how my page looks?
Formatting only changes whitespace between tags. In rare cases whitespace inside inline elements matters; Prettier keeps it where it affects rendering.
Can it format embedded CSS and JavaScript?
Yes. Code inside <style> and <script> tags is formatted along with the markup.
Related tools
JSON Formatter
Format and beautify JSON with configurable indentation and optional key sorting. Errors are reported with exact line and column.
CSS Formatter
Format CSS, SCSS and Less stylesheets into readable, consistently indented code.
JavaScript Formatter
Beautify JavaScript and JSX with Prettier. Choose indentation, quotes and semicolons.
TypeScript Formatter
Format TypeScript and TSX code with Prettier, including types, generics and decorators.
PHP Formatter
Beautify PHP code following PSR-style formatting with the Prettier PHP plugin.
SQL Formatter
Format SQL queries for MySQL, PostgreSQL, SQLite, SQL Server and more with keyword casing options.