XML Formatter
Beautify or minify XML and report parse errors.
Paste XML and press Format, or use Ctrl/⌘ + Enter.
What this tool does
This XML formatter checks that your document is well-formed, then re-indents it so the structure is easy to read: one element per line, children indented by 2 spaces, 4 spaces or a tab, and elements that contain only text kept on a single line. Comments, CDATA sections, processing instructions and the XML declaration are preserved, while whitespace-only text between tags is dropped. Minify does the opposite and removes all whitespace between tags, giving the smallest equivalent document for embedding in a string or sending over the network. The status line shows the size before and after.
Notes and common errors
- Parsing uses the browser's own XML parser, so error messages and line/column wording come from your browser.
- A mismatched or unclosed tag, an attribute without quotes, or a bare & in text are the most frequent causes of "not well-formed" errors. Use &, < and > inside text.
- Only one root element is allowed, and the tool checks well-formedness only; it does not validate against a DTD or XML Schema.
- Whitespace around text in mixed content (text and elements in the same parent) is trimmed when formatting. Use Minify if exact spacing matters.
- SVG, RSS/Atom feeds, Maven pom.xml, Android layouts and SOAP envelopes are all plain XML and format fine here.
Privacy
Formatting runs locally in your browser. Nothing you paste is sent to a server or kept after you leave the page.