XML Formatter

Paste XML to pretty print it as you type. Broken tags are named with their line, and the tree view gives the XPath of every node.

Output
FormatMinifyEscape

Indented, easy to read

Indent
2 spaces4 spacesTab

Spaces or a tab per level

Your XML

Paste XML, drop a file or open one to start.

Your formatted XML shows here as you type, ready to copy or download.

Pretty print XML feeds, sitemaps, SOAP messages and config files, or minify them to a single line before sending.

A free XML formatter with no account and no upload: it runs inside this tab, even on files of up to 50 MB.

  • Broken tags named, with a Fix button
  • The XPath of any node in one click
  • Comments and CDATA kept as written

How to format XML online

Pretty print, check and shrink XML in three steps.

  1. Paste or open XML

    Paste XML into the left box, or drop an .xml, .xsd or .svg file on it. The indented copy shows up on the right.

  2. Fix broken tags

    A red note names the problem, such as a closing tag that does not match, and its line. Fix repairs common slips.

  3. Indent or minify it

    Choose 2 spaces, 4 spaces or a tab, or Minify for one line. Then copy the XML or save it as a new .xml file.

An XML validator that points to the line

The check follows the XML 1.0 rules that browsers, Java and .NET parsers apply: one root element, every tag closed in order, attribute values in quotes and a bare & written as &amp;. The first break is named in plain words, such as "</item> closes <price>, opened on line 12", and its line is marked.

Fix handles the slips that stop most files: a bare & in a URL, a < inside text, attribute values without quotes, stray text before the <?xml line and tags left open at the end. It lists what it changed, so you can look over each repair.

This checks that your XML is well formed, the test xmllint and most XML checkers run first. It does not test the file against an XSD or DTD schema, so XML can pass here and still be refused by a system that expects other elements.

XML viewer with a tree and XPath

Big XML exports are hard to scan even when indented. The Tree tab shows each element as a branch you open and close, with its attributes beside the name and a count of what is inside, so a 20,000 line feed reads as an outline.

Click any element, attribute or text to get its XPath, such as /catalog/book[3]/price or /rss/channel/item[2]/@id, ready for XSLT, Python's lxml or Java. Expand all and Collapse all move between the whole file and its top level.

More than an XML beautifier

  • XML tree viewer

    Open and close elements, see attributes and child counts, and expand or collapse all levels at once.

  • XPath finder

    Click a node in the tree to copy its XPath, with positions like item[2] where siblings share a name.

  • Minify XML

    Drop the spaces and line breaks between tags to send XML as one line. The size saved shows below.

  • Escape and unescape

    Turn XML into &lt;text&gt; to paste inside another document, or unescape it back into real tags.

  • Comments and CDATA kept

    Comments, CDATA, the <?xml?> line and DOCTYPE stay as written, and text inside tags is not touched.

  • Large XML files

    Feeds, exports and logs up to 50 MB open here, read in a background thread so typing stays smooth.

Your XML stays in this tab

SOAP calls, configs and exports often hold keys and customer data, so nothing here is sent or saved.

  • Processing

    Parsing, checking and pretty printing happen in your browser. No XML, password or token goes online.

  • Storage

    What you paste is kept in this browser only, so a refresh keeps it. Clear deletes it from the tab.

  • Account

    No sign-up, no email and no limit on files. Use the XML formatter free, as often as you need it.

Questions about XML

What is an XML file?

A plain text file that keeps data inside named tags, like <price>. XML stands for eXtensible Markup Language.

How do I open an XML file?

Drop it on the box above to read it indented or as a tree. Any browser, Notepad, TextEdit or VS Code opens it as text too.

How do I open an XML file in Excel?

Go to Data, Get Data, From File, From XML and pick the file. Excel turns its repeating elements into rows of a table.

What is the difference between JSON and XML?

Both store data as text. XML wraps values in named tags that can carry attributes; JSON uses keys, arrays and braces.

How do you comment in XML?

Write <!-- your note --> anywhere outside a tag. Two hyphens in a row are not allowed inside, and comments never nest.

What is CDATA in XML?

A <![CDATA[ ... ]]> section holds text that is not read as markup, so < and & can stay as they are, as in code samples.

How do I format XML in Notepad++?

Install XML Tools from Plugins Admin, then pick Plugins, XML Tools, Pretty print. Or paste the XML into the box above.

Is XML case sensitive?

Yes. <Item> and <item> are two different tags, so <Item></item> is an error. Attribute names are case sensitive too.

Still stuck, or found a problem? Email dobliquestudio@gmail.com and we will help.