XML formatter
Indent XML by nesting depth, or collapse it back to one line.
Input
Result
The result will appear here.Your runs
Only runs that cost points are saved.
Sign in to keep a history of your runs.
Re-indents XML, SOAP envelopes, RSS feeds and config files by structure, and collapses them again when you need the compact form for a request body. It re-indents the tag stream rather than rebuilding a document, so comments, CDATA sections, processing instructions and doctypes pass through exactly as written instead of being normalised away.
How it works
- Indentation follows nesting depth; self-closing tags do not open a level.
- Comments, CDATA, processing instructions and doctypes are preserved verbatim.
- Minifying removes the whitespace between tags and nothing else.
Where your data goes
Nowhere. This tool runs entirely in your browser: the text you paste is processed by the page and is never transmitted to a server or written to a log.
When a run costs points, a one-line summary is saved to your own history so you can find it again. The summary records the shape of the run — sizes, counts, the values you looked up — never the content you pasted.
What it costs
Free up to 50.0 KB per run without an account. Past that, a run costs 1 points and is saved to your history.
Points come from signing up, checking in daily, commenting and completing your profile.
See how points workCommon questions
- Will formatting change my document's meaning?
- It can, in one specific case: in mixed content, whitespace between elements is significant, and adding indentation changes it. For data-oriented XML — configuration, SOAP, feeds — it is safe.
- Does this validate against a schema?
- No. It checks that the markup can be tokenised, not that it satisfies a DTD or XSD. Schema validation needs the schema.
- Can I use it on HTML?
- For well-formed XHTML, yes. Real-world HTML has unclosed tags that XML rules cannot make sense of, and the result will be indented misleadingly.
The open-source behind it
This tool is a self-contained implementation. chrisbottin/xml-formatter (MIT) does the same job as a library — if you need this behaviour inside your own program, start there rather than calling a web page.
chrisbottin/xml-formatterAlso known as
- xml formatter
- format xml online
- xml beautifier
- xml minify
- pretty print xml