HTML formatter (indent and beautify)
Format and indent messy or minified HTML online: each tag at its level, with the page's inline CSS and JavaScript formatted too, a choice of 2 or 4 spaces or tab and wrapping of long lines.
How to usePaste your HTML.
HTML formatter (indent and beautify): what it is for
Minified HTML or code copied from elsewhere often comes on a single line, without indentation, hard to read and edit. Paste the code and each tag moves to its level, with the content of style and script tags formatted too.
Choose 2 or 4 space or tab indentation, wrapping long lines at 100 or 120 columns, indenting head and body and whether to keep the original's blank lines. Elements such as pre and textarea are kept as they are. Formatting uses the js-beautify library and runs in the browser.
How to use
- Paste the HTML.
- Choose the indentation and options.
- Copy or download the result.
When to use it
- Reading a page's source code.
- Tidying a template before editing.
- Reviewing HTML generated by another system.
Frequently asked questions
Does formatting change how the page works?
No. Formatting only adds line breaks and indentation between tags. Elements that display whitespace as-is, such as pre and textarea, are kept unchanged.
Are the CSS and JavaScript inside the HTML formatted too?
Yes. The content of style and script tags is formatted with the same indentation rules.
Is my code sent anywhere?
No. Formatting uses the js-beautify library running in your browser; nothing leaves your device.