XML Formatter

Make XML from APIs, sitemaps, RSS feeds and config files readable again. Paste XML to get neatly indented output as you type, with errors pointed out by line — or minify it into a single line for smaller payloads.

Indentation
Options

This tool runs entirely in your browser. Your files and text are processed on your own device and are never uploaded to our servers.

How to use the XML Formatter

  1. Paste XML into the input box or open an XML or text file. Use “Example” to try it.
  2. Choose 2 spaces, 4 spaces or tabs — or Minify to remove whitespace between tags.
  3. If the XML isn’t well-formed, read the error message and line number below the boxes and fix the input.
  4. Copy the formatted XML or download it as an .xml file.

Examples

Indenting a compact document

Input
<catalog><book id="b1"><title>Learning XML</title></book></catalog>
Result
<catalog>
  <book id="b1">
    <title>Learning XML</title>
  </book>
</catalog>

Finding a mismatched tag

Input
<order><item>Pen</order>
Result
An error is reported because <item> is never closed before </order>.

What the formatter keeps

Comments, CDATA sections, processing instructions and the XML declaration are kept. Elements that contain only text stay on one line, and elements that mix text and tags — such as <p>Hello <b>world</b></p> — are left exactly as written, because adding line breaks inside them would change the text.

XML is checked with your browser’s built-in parser. It doesn’t load external files or execute anything, so formatting untrusted XML is safe.

Frequently asked questions

Is my XML uploaded?

No. Formatting and checking happen in your browser on your own device.

What does “well-formed” mean?

Every tag is closed and properly nested, there is a single root element, attribute values are quoted and special characters such as & are escaped. Well-formed XML can be read by any XML parser.

Does it validate against an XSD or DTD schema?

No. It checks that the XML is well-formed, which catches most errors. Schema validation, which checks allowed elements and values, needs the schema itself.

Will formatting change my data?

Only whitespace between tags changes. With “Trim spaces around text values” on, leading and trailing spaces inside text-only elements are removed; turn it off if those spaces matter.

Everything you need. One simple place.

Free, fast online tools for text, PDFs, images, data and everyday maths. Every tool runs entirely in your browser, so your files stay on your device.

  • Privacy-first processing
  • No sign-up required

© 2026 Toolora. All rights reserved.

Built for speed and privacy