Skip to content
Free tool · runs in your browser

HTML formatter

Minified pages, exported templates and AI output often arrive as one long line. Paste it here to get one tag per line with consistent indentation.

What the formatter changes — and what it leaves alone

Block elements (div, section, ul, table…) each get their own line, indented one level deeper than their parent. Inline elements (a, strong, span, img) stay inside the line of text they belong to, so sentences are not chopped up. The contents of <pre> and <textarea> are left exactly as they were, because whitespace there is visible; <script> and <style> blocks are re-indented as a whole but not rewritten.

Formatting does not change how the page looks

Browsers collapse runs of whitespace between tags, so adding line breaks and indentation is invisible on the rendered page in almost every case. The exception is inline-block layouts, where a line break between two elements becomes a small gap — if that happens, the original was relying on the absence of whitespace.

When to format

  • Before editing HTML you copied from "View source" or a template export.
  • When reviewing what an AI assistant wrote, so you can see the structure at a glance.
  • When a validator or browser error gives a line number — after formatting, line numbers point somewhere useful.

To see the result rendered, send it to the HTML viewer; to share it, publish it as a URL.

Related guides

Frequently asked questions

Is formatting HTML safe?

Yes for the rendered page in nearly all cases — whitespace between tags is collapsed by browsers. Keep the original if you rely on inline-block spacing.

Can I choose tabs or spaces?

Yes: 2 spaces, 4 spaces or tabs.

Does it fix broken HTML?

It re-indents but does not repair missing tags. Unbalanced indentation at the end is a hint that a closing tag is missing.

Is my code uploaded?

No — formatting runs in your browser.

More free tools

Paste HTML. Get a URL.

Code, an .html file, a ZIP or a whole folder becomes a live HTTPS URL with your own address, an optional password and a QR code. Free to start with Google sign-in; paid plans keep URLs online for good.

Convert HTML to URL