Skip to main content

Free XML Formatter – Format XML Online

XML Formatter formats and beautifies XML documents online for free. Pretty-print XML with proper indentation.

Written & reviewed by Helperzy Editorial Team · Updated July 2026

How to Use XML Formatter

1

Paste Your XML

Drop in a SOAP response, RSS feed, sitemap, SVG file or configuration document, however flattened it is. The whole document is parsed, so include the root element and any declaration.

2

Format

Click Format and each child element is indented one level under its parent. If the document is not well-formed, the parse error and its position are reported instead of a partial result.

3

Copy Result

Copy the indented XML back into your editor or ticket. Remember this checks well-formedness only, so schema validation against a DTD or XSD is still a separate step.

How the XML Formatter Works and What It Checks

XML has not gone anywhere. It still carries SOAP web service traffic, RSS and Atom feeds, search engine sitemaps, Android layout files, SVG graphics, Maven build definitions and a large share of enterprise configuration. When a document arrives minified onto one line, though, reading it means counting angle brackets by eye. This formatter rebuilds the indentation so each element sits one level under its parent and the tree becomes visible. Developers debugging a SOAP fault, SEO specialists checking a sitemap before submitting it, and designers opening an exported SVG all benefit from the same thing. Alongside the layout it tells you whether the document is well-formed, which is very often the real question you arrived with. Formatting works by parsing the document into a node tree and then writing it back out with controlled whitespace. Every child element gains one indent level relative to its parent, opening and closing tags line up vertically, and self-closing elements stay on a single line. Attributes, attribute order and text content are preserved exactly as written, because changing any of those would change the data. The well-formedness check happens during parsing and enforces the rules XML takes seriously: every start tag needs a matching end tag, elements must nest without overlapping, attribute values must be quoted, there must be exactly one root element, and the characters ampersand, less-than and greater-than must appear as the entities amp, lt and gt inside content. Break any of those and the parser reports the position rather than guessing. Here is a small feed fragment as it often arrives: a single line reading rss version 2.0, then channel, then title Helperzy Blog, then item containing title Base64 Guide and a guid of 4821, then the closing tags. Formatted with two-space indentation it becomes nine lines, with rss at column zero, channel indented once, title and item indented twice, and the item children indented three levels. Now introduce a real error by writing an item title as Base64 & Encoding with a bare ampersand. Parsing stops and points at that character, because a raw ampersand starts an entity reference in XML. Change it to amp with a semicolon and the document parses and formats cleanly again. Practical situations. A developer integrating a legacy SOAP endpoint formats the response envelope to find the fault string buried four levels deep inside the body. An SEO manager formats a generated sitemap to confirm every url element actually contains a loc child before submitting the file to Search Console. A designer inspects an SVG exported from Figma to locate the path element carrying the wrong fill colour among sixty siblings. A DevOps engineer formats a Maven pom file that a bad merge flattened into one line, then finds the duplicated dependency block that was breaking the build. Each of these is a search problem, and indentation is what makes searching by eye possible at all. One distinction to keep straight, because it causes arguments in code review: well-formed is not the same as valid. Well-formed means the syntax rules above are satisfied and the document will parse. Valid means it also conforms to a DTD or XML Schema that dictates which elements are permitted, in what order, and with what content. This tool checks the first, not the second, so a sitemap can be perfectly well-formed and still be rejected for using an element the sitemap schema does not define. Namespace prefixes are preserved but not resolved, and external entity references are not fetched. Also note that if your application treats whitespace inside an element as significant, adding indentation could matter, so check before reformatting such documents. Everything runs in your browser and nothing is uploaded.

Examples: XML Formatter

Input

<rss version='2.0'><channel><title>Helperzy Blog</title><item><title>Base64 Guide</title><guid>4821</guid></item></channel></rss>

Result

<rss version='2.0'> <channel> <title>Helperzy Blog</title> <item> <title>Base64 Guide</title> <guid>4821</guid> </item> </channel> </rss>

The single line becomes nine, with channel one level in, title and item two levels in, and the item children three levels in, so the feed structure is readable at a glance.

Input

<item><title>Base64 & Encoding</title></item>

Result

Parse error: unescaped & at the title text — write it as &amp; instead

A bare ampersand begins an entity reference in XML, so the parser rejects the document until it is written as &amp;; the same rule applies to < and > inside content.

Frequently Asked Questions – XML Formatter

Paste your XML into Helperzy XML Formatter and click Format. The tool rebuilds the document with clean indentation so every element nests visibly under its parent, making the structure easy to read. There is no signup and nothing is uploaded — formatting runs entirely in your browser, so you can tidy as many XML documents as you need instantly.