RevealTheme logo

XML Formatter

Re-indent and line-break minified or messy XML so nested structures become readable. Handy for SOAP envelopes, sitemaps, RSS/Atom feeds, and configuration files.

How to use this tool

  1. 1

    Paste your XML into the text box (one line or many — minified XML works too).

  2. 2

    Read the indented result that appears in the output panel below; it updates automatically as you type, with no button to press.

  3. 3

    Select the formatted text in the output panel and copy it manually into your editor or file.

How does this XML formatter indent your markup?

XML (Extensible Markup Language, a W3C standard) nests elements between matching opening and closing tags, but a minified or single-line document hides that structure. This tool makes the nesting visible by inserting a line break between every adjacent pair of tags (it splits wherever a '>' is immediately followed by a '<') and then indenting each line by two spaces per level of depth. It is a lightweight regex-based reindenter, not a real XML parser: it does not check that your document is well-formed, does not validate against a DTD or XSD, and never reports errors. Depth is tracked by counting opening versus closing tags, with self-closing tags like <br/>, processing instructions like <?xml?>, and comments correctly left at the same level. Inline content such as <name>John</name> stays on one line because the whole line is a single bare element. Because the split keys on the '>' character, a literal '>' inside an attribute value or a multi-line comment can be mis-split and throw off the indentation. For strict validation or schema checks, reach for xmllint or a dedicated XML validator.

Common use cases

  • Make a one-line SOAP response from a web service readable so you can trace which element holds a fault or value.

  • Re-indent a minified sitemap.xml or RSS/Atom feed before scanning it for missing or duplicated entries.

  • Tidy a hand-edited Maven pom.xml, Android layout, or Spring config so the nesting is obvious at a glance.

  • Pretty-print an XML API payload pulled from logs or a network capture for a quick visual review.

  • Turn an exported config blob (build files, .csproj, web.xml) into an indented form before diffing it against another version.

  • Format a snippet for a bug report or documentation so reviewers can follow the element hierarchy.

Frequently asked questions

Does this validate my XML or check that it is well-formed?
No. It only adds indentation and line breaks. It never parses the document, checks for mismatched or unclosed tags, or reports errors. Run xmllint or an online validator if you need real validation.
Can I validate against an XSD or DTD?
No — schema validation is out of scope for this reindenter. Use xmllint with the --schema flag or a dedicated XSD validator.
Can I change the indent size?
Not currently. The indentation is fixed at two spaces per nesting level and there are no options to configure it.
Is there a Format button, or a way to copy or download the result?
There is no button — the output updates live as you type or paste. To save it, select the formatted text in the output panel and copy it manually; there is no built-in copy or download control.
Are XML namespaces preserved?
Yes. Prefixes like <soap:Envelope> are treated as ordinary tag text, so namespaces pass through untouched. The formatter only changes whitespace, never your tag or attribute names.
Why is some of my XML indented incorrectly?
The tool splits wherever a '>' is immediately followed by a '<', so a literal '>' inside an attribute value or inside a multi-line comment or CDATA block can be mis-split and shift the indentation. Mismatched tags can also skew levels because depth is just a tag count. For those edge cases use a true XML parser.
Is my XML uploaded to a server?
No. Formatting runs entirely in your browser with JavaScript. Your XML never leaves the page and nothing is sent over the network.

Related tools