XML formatter and validator
Pretty-print or minify XML, and check that every tag is properly closed.
Runs entirely in your browser. Your files never leave your device.
About this tool
A sitemap, an RSS feed, an SVG icon, a SOAP response or an Android layout often arrives as one long unreadable line. Paste it and Format puts every element on its own line with nested elements indented, while short elements holding only text stay compact. Minify does the reverse, stripping comments and spaces between tags to save bytes.
At the same time, the tool checks that the document is well formed: every opening tag must be closed in the right order. If something is wrong, the message names the tag and the line where the problem starts, which is often hard to spot by eye in a large file. CDATA sections, comments and the XML declaration are kept as they are.
How it works
- Paste your XML.
- Choose Format or Minify, and the indentation.
- Read the well-formedness check.
- Copy or download the result.
The check covers tag balance and malformed tags. It does not validate against a schema (XSD or DTD), which would need the schema file.
Worked example
A one-line sitemap of 50 URLs becomes readable, one <url> block per entry with its <loc> and <lastmod> indented inside.
If a closing tag is missing, the message names it and the line, for example an unclosed <url> on line 212, which is hard to find by eye in a long file.
Good to know
- Escape & as & in text and attributes: a raw ampersand is the most common reason for invalid XML.
- Minify only for transfer; keep the formatted version under version control.
- HTML is not always well-formed XML; use the HTML viewer for web pages.
Frequently asked questions
What is well-formed XML?
Does formatting change the data?
Can I format HTML with it?
and