Skip to content

XML Formatter

Pretty-print XML with clean, nested indentation.

  • 100% Free
  • No Sign Up
  • Works in Your Browser

XML formatter

Indent XML so it's readable

Indent

Valid XML

Everything runs in your browser. Nothing is uploaded.

More Developer Tools

View all tools

Every everyday developer tool, right in your browser.

No installs. No uploads. No signup.

Browse all 36 tools
Developer tools
36
Cheat sheets
10
Bytes uploaded
0

How to use the XML formatter

Three steps, all in your browser.

  1. 1

    Paste your input

    Type or paste your code or data. Press Sample to try an example.

  2. 2

    Pick the style

    Choose indentation or options. The result updates as you type.

  3. 3

    Copy the result

    Copy the output in one click. Nothing is saved or sent anywhere.

XML Formatter: what to know

The XML formatter parses your document and writes it back out with each element on its own line, indented by depth. It's the quickest way to read a SOAP response, an RSS or Atom feed, a sitemap, an SVG file or a Maven pom.xml that arrived as one long line.

Malformed XML is reported instead of guessed at. XML is strict: every element must be closed or self-closing (<br/>), tags must nest without overlapping, attribute values must be quoted, there must be exactly one root element, and the characters & and < must be escaped as &amp; and &lt; in text.

Only the whitespace between elements is re-indented; text is never changed. Mixed content, where text and tags are interleaved as in XHTML or DocBook, CDATA sections, comments and elements with xml:space="preserve" are kept exactly as written, because whitespace there can be meaningful. Errors are found with fast-xml-parser's validator and reported with their line and column.

Popular uses

  • Reading SOAP and legacy API responses
  • Inspecting RSS, Atom and sitemap files
  • Tidying Android layouts, pom.xml and other XML configs
  • Finding the unclosed tag in a broken document

Tips for the best result

  • An error about an 'unescaped &' usually comes from a URL with query parameters inside the XML; write it as &amp;.
  • A byte order mark or blank line before the <?xml ...?> declaration makes some parsers fail; the declaration must come first.
  • To compare two XML files, format both here first and then use the diff checker.

Read how JustYourDev works and our privacy details. Code, data and files you use here are processed in your browser and are never sent to our server.

Frequently asked questions