Skip to main content

Data

XML Formatter & Beautifier

Pretty-print any well-formed XML document with consistent indentation.

Written by · Published · Last updated

Runs in your browserPrivate by designXML → XML
XML→XML

Press ⌘ Enter to run

5 lines · 194 chars

Ready; press Run or ⌘ Enter

How this tool handles files

Processing
In your browser, on-device
Storage
Nothing stored
Output
A file you download
Your responsibility
Review before official use
  • Runs in your browser. Your file is processed on your own device and, on this site, is not uploaded to our servers.
  • Nothing is stored. Your file and its output are gone the moment you close or reload the page.
  • Review sensitive files (bank, ID, medical) and check the output before sharing it.

Every tool on FormatOS runs in your browser. Read our Privacy Policy and File Handling Policy.

Common uses

  • Make minified XML readable
  • Inspect XML payloads while debugging

Limitations

  • Input must be well-formed XML

When XML pretty-printing earns its place

This tool takes well-formed XML and writes it back with two-space indentation, one element per line, so the structure becomes legible. The most common fit is debugging: when an API hands you a minified SOAP envelope, an RSS or Atom feed, or a single-line config blob, formatting it turns a wall of angle brackets into a tree you can trace tag by tag.

It suits developers and integrators inspecting payloads, and office and admin work where XML turns up indirectly: sitemap files, app and plugin configuration, and the XML inside documents. For a sample pasted into a ticket, a code review or documentation, the indented version reads far better than the raw stream.

Paste or drop, format, then copy or download

Paste your XML, open an .xml file or drop one on the input, run the formatter, and copy the result or download it. Everything runs in your browser; no XML is uploaded, and nothing persists once you close the tab.

The document is parsed first. If it is not well-formed (a missing end tag, a bare &, mismatched nesting, text outside the root), you get the line, the column and the reason, and nothing is reformatted. A valid document is written back with each element on its own line, indented two spaces per level.

Elements that hold only text stay on one line, such as <name>FormatOS</name>. Elements that mix text and child elements are kept on one line with their text untouched, because whitespace in mixed content can be meaningful. Comments, processing instructions, CDATA and the XML declaration are kept.

It needs well-formed XML, not an HTML fragment

HTML fragments, JSX and templating snippets with unclosed tags or bare attributes are rejected; this is an XML formatter, not a lenient cleanup tool. Only XML's own entities (&lt; &gt; &amp; &quot; &apos;) and numeric references are understood, so an HTML name such as &nbsp; is reported. Entities declared in a DOCTYPE are not expanded.

It does not validate against a DTD or XSD schema, reorder attributes or rewrite namespaces, and the style is fixed at two spaces. Formatting rewrites the markup: attribute values end up in double quotes, empty elements may be written as <tag/>, and references such as &#65; become the characters they stand for.

Checking the output before you trust it

Scan that the root element opens and closes once, the indentation depth matches the nesting you expect, and repeated elements appear the number of times you expect. Spot-check accented characters and symbols to confirm they came through intact.

For anything official or financial (invoices, regulatory filings, e-invoicing XML, signed documents), treat formatting as cosmetic and keep the original. Any rewrite changes the bytes, which breaks a digital signature or checksum, so never replace a source-of-record file with the formatted copy without confirming the consuming system still accepts it.

Frequently asked questions

No. It re-indents the document so the nesting is easy to read; elements, attributes and text are unchanged. The markup is rewritten, though: attribute values use double quotes and character references are written as characters, so the result is equivalent but not byte-for-byte identical.

Nothing is formatted. You get the line and column of the first problem and the reason, such as 'expected </item> but found </list>' or 'a bare & must be written as &amp;'.

No. The conversion runs in your browser; your text or file is processed on your own device and, on this site, is not uploaded to a server, and we do not intentionally store it.

Related data tools

Tool last reviewed: September 27, 2026 · Report a problem