Skip to content
Convertto

XML Formatter & Beautifier — Indent, Minify and Check

Format messy XML with proper indentation, or minify it back down, with well-formedness checked.

To format XML, paste it in and it is re-indented with each element on its own line — except elements holding only text, which stay on one line because splitting them across three is what makes formatted XML unreadable. The document is parsed by your browser's own XML parser first, so anything not well-formed is reported with its line and column rather than silently mangled.

Runs in your browser
Privacy
Runs entirely in your browser — nothing is uploaded
Cost
Free, unlimited, no sign-up

Frequently asked questions

Why does formatting change my document?

It should not change anything meaningful, but XML whitespace is technically significant — a parser is entitled to treat the spaces inside an element as content. For mixed-content documents such as XHTML, re-indenting genuinely alters the text. For data XML, which is nearly all XML, it is safe.

What is the difference between well-formed and valid XML?

Well-formed means the syntax is correct: tags nested and closed, one root element, attributes quoted. Valid means it also matches a schema or DTD that says which elements may appear where. This checks well-formedness; a schema check needs the schema.

Why does my XML fail on an ampersand?

A bare `&` starts an entity reference, so `Smith & Jones` is a syntax error. Write `&amp;`, or wrap the value in a CDATA section. The same applies to `<` inside text, which must be `&lt;`.

How to use the xml formatter

  1. 1Enter or paste your xml.
  2. 2Choose the mode.
  3. 3Choose the indentation.
  4. 4Turn "Collapse empty elements to self-closing tags" on or off as needed.
  5. 5The result appears immediately — copy or download it.

Embed this tool

Put the working xml formatter on your own site. It runs in your visitors' browsers exactly as it does here — free, no account, nothing uploaded.

Share this tool

Last updated

More data & format tools