Skip to the content

Contact usFree tools · No signup · Files stay on your device

XML Formatter & Validator

Paste XML to check that it is well-formed and re-print it cleanly, or squeeze it down to one line. Text, CDATA and entities are kept exactly as you wrote them.

  • PrivateYour data never leaves this device
  • No uploadsProcessed in your browser, not on a server
  • 100% freeNo signup, no watermark, no trial
  • UnlimitedUse it as often as you like, no daily caps

How we protect your privacy →

Options

Mode

XML input

Formatted XML

Output appears here.
Was this tool helpful?
How it works

How to use the XML Formatter.

4 short steps. Nothing to install, nothing uploaded.

  1. 1

    Paste your XML, click Open file, or press Sample to try it.

  2. 2

    Choose Beautify (2 spaces, 4 spaces or tabs) or Minify.

  3. 3

    Optionally remove comments, sort attributes A–Z or collapse empty elements like <a></a> into <a/>.

  4. 4

    Copy the result or download it as a .xml file. If the XML is not well-formed, the error shows its line and column, and Go to error selects it in the input.

Guides

Guides for XML Formatter

All

XML to JSON: the complete guide to converting XML data

Learn how to convert XML to JSON online: how attributes, text, repeated tags and namespaces are written, what each option does, and what JSON cannot…

XML Formatter: the complete guide to validating and beautifying XML

A complete guide to formatting XML online: beautify or minify, pick the indent, sort attributes, strip comments, and read every well-formedness error…

JSON to XML: the complete guide to converting JSON data

How to convert JSON to XML online: how arrays, @attributes and #text are written, why a root element appears, how invalid key names are fixed, and…

Word to Text: the complete guide to getting plain text from Word files

How to get plain text out of a Word .docx file: how headings, lists, tables and links are laid out, how to wrap lines at 72 or 80 characters, and what…

Word to Markdown: the complete guide to converting DOCX to MD

How to convert a Word DOCX to GitHub-flavoured Markdown: headings, lists, tables, escaping, pictures and page breaks, and what Markdown cannot keep…

Word to HTML: the complete guide to clean HTML from DOCX

How to convert Word to clean HTML: full page or body only, minimal, inline or no styles, pictures, tables and lists, plus what is not carried over…

Page 1 of 19
Questions

Frequently asked questions.

Quick answers about the XML Formatter.

What does an XML formatter do?
It re-prints XML with consistent indentation and line breaks so nesting is easy to read. Only the whitespace between elements changes; the data does not. The same check tells you if the XML is well-formed, with the line and column of the first problem.
Does it change my text content?
No. Text, CDATA sections and entities such as &amp; are written exactly as you typed them, and an element that holds text (including mixed content like <p>Hi <b>there</b></p>) is left untouched inside, because the spaces there belong to the content.
What does well-formed mean, and is this a schema validator?
Well-formed means the syntax is correct: tags match and nest, attributes are quoted and unique, special characters are escaped and there is one root element. This tool checks that. It does not check a DTD or XSD, so it cannot tell you if the elements are the ones a schema expects.
What do minify, sort attributes and collapse empty elements do?
Minify removes the indentation between elements to make the file smaller. Sort attributes puts them in A–Z order inside each tag, which makes diffs easier to read. Collapse empty elements writes <a></a> as <a/>. None of them changes what the XML means.
Is it safe for XML from an untrusted source?
Yes. It runs in your browser, never loads external files and never expands custom entities, so XXE and entity-expansion attacks do nothing. Input over 10 MB or nested more than 512 levels is rejected with a message.
Is my XML uploaded anywhere?
No. Parsing and formatting happen locally in your browser, so configs, feeds and API payloads never leave your device.