HTML formatter
Format HTML with consistent indentation using Prettier in a local worker. Choose a preferred line width and one attribute per line, find and replace literal text, and download the result. Pasted markup is treated as text and never rendered as a live page.
How to Format HTML Code for Readability
Find & replace in input
Undo: Ctrl/Cmd+Z · Redo: Ctrl/Cmd+Shift+Z or Ctrl+Y. Up to 20 steps and 4 million retained characters in this tab. Clear discards history.
HTML formatter: how to use it
- Paste HTML or open a local text file.
- Choose indentation and format.
- Review the formatted markup and copy or download it.
Limits and notes
Preferred line width is a formatting hint, not a hard maximum. Formatting can change source layout. Strict whitespace sensitivity is used, but verify application-specific template behavior before replacing production files. HTML preview and remote URL imports are deliberately unavailable. Original parser details may be in English. Limit: 1 million characters.
How your privacy works →HTML formatter: common questions
Will scripts in my HTML run?
No. Input and output are plain text editors. The formatter does not mount the markup in the page or load referenced images and scripts.
Does formatting sanitize HTML?
No. Formatting changes presentation of source code; it does not make untrusted HTML safe to render elsewhere.
Can this formatter fix invalid HTML?
It can print inferred closing markup for some accepted input, while other input produces a parser error. It is not a general repair tool or an HTML conformance validator; review the result and test it in the intended environment.
Will JavaScript and CSS inside HTML be reformatted?
A separate embedded JavaScript or CSS formatting pass is disabled and there is no toggle to enable it. HTML printing can still change surrounding indentation and line layout, so embedded regions are not guaranteed to remain byte-identical.