EN
PortuguêsEnglishEspañol
All tools
Developer tools 100% free

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 use

Thank you so much for helping!

Every donation helps pay for the servers and keeps the tools free for everyone. Pick or type an amount:

Secure payment by Stripe. Opens in a new tab.

Back to Format and convert

Paste your HTML.

Available in: PortuguêsEnglish

Advertisement

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

  1. Paste the HTML.
  2. Choose the indentation and options.
  3. 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.

Similar tools

The tools are provided as is, without warranty. We are not responsible for the results or for how they are used.