HTML Formatter
Format and indent HTML properly, preserving inline elements and whitespace sensitivity.
To format HTML, paste your markup and it is re-indented with proper nesting. Prettier understands which elements are whitespace-sensitive, so it will not insert line breaks that would visibly change how inline elements such as span and a are rendered.
Runs in your browser- Privacy
- Runs entirely in your browser — nothing is uploaded
- Cost
- Free, unlimited, no sign-up
Frequently asked questions
Why did some tags stay on one line?
How to use the html formatter
- 1Enter or paste your html.
- 2Set the line width.
- 3Set the indent size.
- 4Turn "Indent with tabs" on or off as needed.
- 5The result appears immediately — copy or download it.
Embed this tool
Put the working html formatter on your own site. It runs in your visitors' browsers exactly as it does here — free, no account, nothing uploaded.
Share this tool
Related tools
CSS, SCSS & Less FormatterFormat stylesheets with consistent indentation, spacing and property ordering.Markdown to HTML ConverterConvert Markdown to clean HTML, or turn existing HTML back into Markdown.JavaScript & TypeScript FormatterFormat JavaScript, TypeScript, JSX and TSX properly with Prettier.Markdown FormatterTidy Markdown — normalise headings, lists, tables and emphasis markers.HTML Entity Encoder & DecoderConvert characters to HTML entities and back — escape markup safely for display.YAML Formatter & ValidatorFormat and validate YAML — catch the indentation mistakes that break CI pipelines.
Last updated
More data & format tools