- All tools
- XML formatter
How do I format, validate or minify XML?
Paste your XML and press Format to get clean, indented XML, or Minify to remove the extra whitespace between tags. The page also checks that the XML is well-formed and tells you the line and column of the first problem. It does not validate against a schema (XSD or DTD).
- Paste your XML into the box, or keep the example.
- Choose the indentation and options you want.
- Press Format or Minify, then copy the result.
What this page can do
- Pretty-print XML with 2 spaces, 4 spaces or tabs
- Check that the XML is well-formed and show the line and column of the first error
- Minify by removing the whitespace between tags, keeping or removing comments
- Keep the XML declaration, comments, CDATA sections, processing instructions and DOCTYPE as written
- Optionally sort attributes or put each attribute on its own line
- Copy the result or download it as an .xml file
When to use this page
- Making a one-line SOAP response, RSS feed or config file readable before you debug it.
- Finding the exact spot of a missing closing tag or a stray ampersand.
- Shrinking XML before pasting it into a request, a test or a config field.
When to use something else
- You need to validate against an XSD, DTD or Schematron: use xmllint, your IDE or a schema validator.
- You need XPath, XSLT or a canonical form for signatures: use a dedicated XML tool.
- Your file is very large, hundreds of megabytes: use a command-line tool such as xmllint instead of a browser tab.
How it compares with other options
Editors such as VS Code, IntelliJ and Oxygen, and the command-line tool xmllint, can format XML and validate it against schemas, and they are the better choice if you work with XML every day. This page is quicker for a one-off paste and needs nothing installed. It checks well-formedness only, using its own parser, so very unusual constructs such as complex DOCTYPE internal subsets are passed through as written rather than checked, and its layout rules may differ from your editor’s.
Where your text goes
Nowhere. Formatting, checking and minifying are done by your own browser with code that loads together with the page. Nothing you paste is sent to a server, saved to an account or written to browser storage. You can check it yourself: open your browser’s network panel — the page still loads its own code and any ads, but no request carries your XML.
Questions about this tool
Does formatting change my XML?
Formatting only changes the whitespace between tags. Tag names, attributes, text, comments, CDATA sections and the XML declaration are kept as written. An element that mixes text with child elements, such as a paragraph with some bold words, is kept on one line exactly as typed, because added line breaks could change its meaning. Be careful with XML where whitespace is significant, such as xml:space="preserve" content, and keep your original if in doubt.
What does well-formed mean, and does this check my schema?
Well-formed means the XML follows the basic syntax rules: one root element, every tag closed in the right order, quoted attribute values, no repeated attributes and no stray ampersands. The page checks exactly that. It does not check your XML against an XSD or DTD, does not resolve namespaces and does not load external entities, so XML can pass here and still be rejected by a schema validator.
Why does it say my XML has a problem when another tool accepts it?
Some tools are forgiving and accept HTML-style markup such as unquoted attributes, a bare & in text or several root elements. XML parsers are strict, so this page reports those as errors and shows where the first one is. Fix that spot and press Format again; later errors appear one at a time.
Is my XML saved or sent anywhere?
No. The XML is formatted by your browser with code that loads together with the page. It is not sent to a server or stored in your browser; closing or reloading the tab clears it, so copy the result somewhere safe first.