HTML Formatter
Prettify or minify HTML with one click. Configurable indentation, inline-element aware — free, browser-based, no uploads.
HTML Input
How to format HTML
- Paste your HTML into the input area.
- Choose Prettify to add readable indentation or Minify to strip whitespace.
- Set the indent size (2 or 4 spaces) when prettifying.
- Click the format button and copy the result.
Privacy — processed in your browser
Formatting uses the browser's built-in DOMParser to parse HTML and serialize it. Your HTML is never sent to any server.
Frequently Asked Questions
Does this validate my HTML?
DOMParser parses HTML leniently (as browsers do). It does not throw errors for invalid HTML — it silently corrects unclosed tags and nests elements correctly. For strict validation, use an HTML validator tool.
Will this change my HTML semantics?
Prettifying only changes whitespace. It does not reorder attributes, add or remove tags, or alter content. Minifying removes comments and collapses whitespace.
Can I format just a snippet (not a full page)?
Yes — paste any HTML snippet. The formatter works on fragments as well as full documents.