How to use the XML Formatter
Paste your XML, choose pretty print or minify and the indent size, then copy the result. Errors in tag nesting are reported instead of output.
Pretty print or minify
Pretty printing puts each element on its own line and indents children under their parents, which makes feeds, sitemaps and config files easy to read and compare. Minifying removes the whitespace between tags to make the file smaller for sending over a network. The data inside stays the same either way.
Well formed XML
Every opening tag needs a matching closing tag, tags must close in the reverse order they opened, and there must be a single root element. The formatter checks this nesting as it goes. It does not validate against a schema or DTD, so a file can be well formed and still be missing data an app expects.
How it works
Tokenizes tags and text, tracking a stack of open elements.
Examples
- With the default values
<?xml version="1.0"?> <catalog> <book id="1"> <title>Dune</title>
Limitations and assumptions
Checks tag nesting only. It does not validate against a schema or DTD, or expand entities.
Frequently asked questions
Does it validate my XML?
It checks that tags are properly opened, closed and nested. It does not check against a schema.
Can I choose the indent size?
Yes. Pick the indent you prefer before formatting.
Is my XML uploaded?
No. Formatting happens in your browser.