XML Formatter

  • Free forever
  • No sign-up
  • Runs in your browser
Processed on your device

Format and validate XML: indent it neatly, or minify it. Errors show exactly what is wrong.

About XML Formatter

Indents XML so the structure of a feed, sitemap, SOAP message, config file or API response is easy to see, or minifies it to save space. It first checks that the XML is well-formed, so a missing closing tag or a stray ampersand shows up straight away. Comments, CDATA sections, processing instructions and the XML declaration are kept, and you choose whether comments go when minifying.

How to use XML Formatter

  1. Paste your XML into the box, such as a feed, sitemap, config file or API response.
  2. Choose an Indent of 2 spaces, 4 spaces or Tab.
  3. Click Format XML to indent it, or Minify to strip the spaces, optionally removing comments too.
  4. If there's an error, read the message and fix that spot, then click Copy when you're done.

How your data is handled

Parsing and formatting use your browser's built-in XML parser, with no extra downloads. The XML you paste, including any keys or personal data in it, isn't uploaded or stored.

How SAA Tool works · Privacy Center

Limits and accuracy

  • Spaces around text are trimmed and mixed text-and-tag content is split onto lines, which can change whitespace-sensitive XML.
  • An internal DTD subset inside the DOCTYPE, in square brackets, is dropped when formatting.
  • Error wording comes from your browser's parser, so the detail differs between Chrome, Firefox and Safari.
  • Character references such as é are written back as the plain character.

Questions and answers

Does it validate against a schema (XSD or DTD)?

No. It checks that the XML is well-formed, meaning every tag is closed, nested and quoted correctly. It doesn't check the content against an XSD or DTD.

What happens to comments and CDATA?

Comments and CDATA sections are kept when you format. When you minify, comments are removed unless you untick Remove comments when minifying, and the XML declaration at the top stays.

Is my XML uploaded?

No. Parsing and formatting happen in your browser, so your files aren't sent to SAA Tool or stored anywhere.

Do I need to sign up?

No. XML Formatter and Validator is free with no sign-up, no login and no daily limit, and there's nothing to install. It works on a phone as well as a PC.

Does it also validate the XML?

Yes. Unclosed or mismatched tags are reported with the line number; valid XML is indented with one element per line.

Sources and standards

Report a problem with this tool