Staring at an XML response, feed, or config file collapsed onto one line? This free xml formatter lays each element out on its own line, indented under its parent, and tells you the line and column when the document is not well-formed. Everything runs in your browser, so nothing is uploaded, no account is needed, and no signup stands between you and the result.

How to use this xml formatter

Three quick steps — no signup, no cost.

1Paste your XML

A single-line response, a feed export, or a config file — indentation and line breaks do not need to be right already.

2Choose your indent

Pick 2 spaces, 4 spaces, or a tab, then format. If the document is malformed, you get the error’s line and column instead of scrambled output.

3Copy or download the result

Take the readable document back into your editor, or switch to minify for a compact single line when size matters.

Why this xml formatter is careful with your document

Readable output without quietly changing the data.

Well-formedness checked first

Tags must open and close properly, attributes must be quoted, and the document needs exactly one root element — otherwise you get a clear error, not a guess.

Formatting and minifying in one place

Spread a collapsed document out for debugging, or collapse a readable one down for an API payload, without switching tools.

Your choice of indent

2 spaces, 4 spaces, or a tab, so formatted output matches the style of the project it is going back into.

Private by construction

The browser’s own XML parser does the work on your device, so feeds and configs containing internal names never leave it.

The whitespace traps: when formatting must leave text alone

Most of the time formatting only moves whitespace between tags. These are the cases where touching it would change the data.

Text inside an element is data. The spaces in <name> Ada </name> belong to the value, so a careful formatter never trims them. If your data has meaningful spacing, formatting must not normalise it away.

Mixed content stays as written. In a paragraph like <p>Hello <b>world</b> again</p>, the spaces around the bold element belong to the sentence. Re-indenting there would change what the sentence says.

xml:space=”preserve” is a promise. An element marked this way keeps every space and line break inside it when formatting or minifying, as the XML specification intends.

CDATA sections are never re-indented. The text between <![CDATA[ and ]]> keeps its spaces and line breaks in both modes, because its whole point is to hold literal text.

Well-formed is not the same as valid. A well-formed document follows XML syntax rules; a valid document also matches a schema such as an XSD or DTD. This tool checks the first, not the second — schema validation is a separate job.

XML Formatter FAQs

Short, direct answers to the questions readers ask most.

It reads an XML document and rewrites it with one element per line and consistent indentation, so nesting and structure are easy to follow.

No, when done carefully: only whitespace between tags moves, while text content, attribute values, comments, and CDATA sections stay exactly as they were.

Well-formed means the syntax rules hold — closed tags, quoted attributes, one root element. Valid additionally means the document matches a schema such as an XSD or DTD.

It names the problem with its line and column, so you can jump to the unclosed tag, overlapping nesting, or unescaped character that broke the parse.

Yes. It runs entirely in your browser with no account, no signup, and nothing uploaded.

Related Tools

More free converters that work the same way — right in your browser.

Try the related tools above, or go back to the Convertion homepage for more free converters.