Skip to main content

XML Formatter

Pretty-print XML with consistent indentation.

What does this tool do?

Direct answerXML Formatter re-indents your document consistently without changing any elements, attributes, or text.
Key factXML allows exactly one root element; the formatter validates this while parsing.
ProcessingRuns locally in your browser; no data is sent to a server.

How to use

  1. Paste XML into the input.
  2. Click Format XML.
  3. Copy the indented result.

Example

Input

<root><item id="1">first</item></root>

Output

<root>
  <item id="1">first</item>
</root>

Who is this for?

This tool was built for people who need a fast answer in the browser — no install, no account, no data leaving the device.

Developers formatting API responses or config files, analysts inspecting minified payloads, and students learning structured data formats. If you have ever squinted at a one-line blob hoping to find a missing brace, this page is for you.

Frequently asked questions

Does formatting change my XML?

Only whitespace between elements. Tags, attributes, ordering, and text content are preserved.

Are comments kept?

Yes, comments are preserved in the output.

What if my XML is invalid?

The formatter reports a parse error with position context instead of producing broken output.

More tools in this category