Format XML online
Turn a wall of unindented XML into something readable — or the other way round, when what you need is the smallest file. Add your file, choose a mode, and download the result.
This reformats whitespace between tags; it does not validate the document against a schema or check that every tag is closed correctly. Comments and CDATA sections are always kept byte for byte, since their content is meant to be taken literally rather than reformatted.
Your file never leaves your device. Formatting runs entirely in your browser, so nothing is uploaded, stored, or scanned.
or drop them here — nothing is uploaded
How to xml formatter
Add your XML file
Drop one or more .xml files into the box, or click to browse.
Choose pretty print or minify
Pretty print indents nested elements for reading, with a choice of 2 spaces, 4 spaces, or a tab. Minify strips every unnecessary character for the smallest file size.
Format and download
Press XML Formatter. Each file downloads with the same markup, reformatted.
Frequently asked questions
Is my file uploaded anywhere?
No. Formatting runs in your browser using JavaScript, so your file stays on your device. You can confirm this by opening your browser devtools Network tab while working — there are no upload requests.
Does this validate my XML?
No. This is a formatter, not a validator — it does not check a schema or DTD, and it does not confirm every tag is properly closed. Badly malformed XML may reformat oddly rather than being rejected outright. If you need to confirm the file is correct, validate it first; use this once you know it's good.
Will this preserve mixed text and elements exactly, like `<p>Hello <b>world</b>!</p>`?
Not precisely — content that mixes plain text with nested elements is re-flowed onto separate lines rather than kept inline, since there is no reliable way to reformat that case without changing its whitespace. This matters for document-style XML (like XHTML fragments); for data-style XML — config files, feeds, API payloads — where each element holds either text or child elements but not both, formatting is exact.
What happens to comments and CDATA sections?
They are copied through exactly as written, on their own line in pretty-print mode. Their content is meant to be taken literally, so reformatting the whitespace inside them would change what they represent.
Is there a limit on how many files?
Twenty at a time, which is a limit of your device rather than our policy — everything is held in memory while it works.
Can I format JSON instead?
That is JSON Formatter, a separate tool built for that format.