ToolSink

HTML Formatter

Indent, prettify or minify HTML, XML and JSX. 100% client-side — your markup never leaves the browser.

What is the HTML Formatter?

The HTML Formatter indents and prettifies HTML, XML and JSX markup, including the JavaScript and CSS inside inline `<script>` and `<style>` blocks. Paste minified build output or one-line CMS markup and get back readable source.

Readable nesting makes mismatched containers, dense attributes and embedded resources easier to inspect. Minify mode reverses the presentation for cases where compact output is useful.

Formatting runs in your browser. Although the intent is whitespace-only formatting, whitespace can be meaningful in preformatted or inline text, so generated output should be reviewed before replacing production templates.

How to use the HTML Formatter

  1. 1Paste the raw HTML, XML or JSX into the input box.
  2. 2Pick an indent size (2 or 4 spaces).
  3. 3Click "Format" and copy the output — or minify with a single click.

When to use the HTML Formatter

  • Expand minified page source while diagnosing an unexpected DOM structure.
  • Clean up a one-line CMS or email template before making a targeted edit.
  • Indent XML configuration so nested elements and closing tags are easier to audit.
  • Format a JSX snippet copied from generated output for discussion in a code review.

Key features

  • Formats HTML, XML and JSX
  • Beautifies embedded script and style blocks
  • Minify mode for production output
  • Attribute order preserved by default

Important notes

  • Formatting occurs locally in the browser, but you should still remove unnecessary secrets or personal data from any source snippet.
  • Always review whitespace-sensitive markup, templates and generated JSX before replacing the original.

Frequently asked questions

Will it change my code semantically?

No — only whitespace changes. The DOM is identical after parsing.

Does it support Vue or Svelte syntax?

Vue single-file components format reasonably; Svelte-specific syntax is not fully supported.

Can whitespace ever affect the rendered page?

Yes. Whitespace matters inside elements such as `pre`, and spaces between inline elements can affect text flow. Review sensitive templates after formatting.

Does the tool execute scripts in pasted HTML?

No. It treats the input as source to format rather than loading it as a live page.

Tap any tool to jump straight in — no signup, works on mobile.

View all →