Free XML formatter — no signup, no install
XML Formatter Online, up to 5 MB
An XML formatter that turns minified or messy markup into a cleanly indented tree the moment you paste it. Pick 2-space, 4-space, or tab indentation, minify back to a single line, strip comments, and catch well-formedness errors with the exact line and column — all in the browser, all free.
- 100% free
- No signup
- Up to 5 MB
- Beautify or minify
- Preserves attributes
The formatted result appears here.
Paste XML, drop a file, or press Ctrl+V anywhere on this page.
How to format XML online
Three steps — paste, pick your indentation, copy the result. No signup, no install.
Load your XML into the formatter
Paste XML into the left panel, drag and drop an .xml file onto the editor, or press Ctrl+V (⌘V on Mac) anywhere on the page. The formatter accepts documents up to 5 MB — .xml, .xsd, .xsl, .svg, .rss, .plist, and every other XML dialect.
Choose your indentation style
Select Beautify to re-indent the document with 2 spaces, 4 spaces, or a tab — whatever your project style guide requires. Switch to Minify to collapse the entire document to a single line, cutting whitespace by 20-40%. Toggle 'Strip comments' to remove all <!-- … --> blocks.
Copy or download the formatted output
The right panel updates as you type. Click Copy to put the result on your clipboard, or Download to save it as an .xml file. If the XML has a syntax error, the status bar shows the exact line, column, and the offending source line.
Technical specifications
| Accepted input | Any XML — .xml, .xsd, .xsl/.xslt, .svg, .rss, .atom, .wsdl, .kml, .plist, .config, pom.xml |
|---|---|
| Beautify options | 2 spaces, 4 spaces, or tab indentation per nesting level |
| Minify | Collapses the document to a single line, removing all unnecessary whitespace |
| Maximum document size | 5 MB, about 150,000 lines |
| Validation | Well-formedness check reporting the line and column of the first error |
| Preserved exactly | Attribute order, quote style, XML declaration, DOCTYPE, CDATA, comments, entities, namespace prefixes |
| Processing location | Your browser — the XML is never uploaded to a server |
| Price | Free, no signup, no limit on the number of documents |
Frequently asked questions
What does this XML formatter do?
It takes raw, minified, or inconsistently indented XML and re-prints it as a cleanly nested tree. You pick the indentation — 2 spaces, 4 spaces, or a tab per level — and the formatter applies it to every element, attribute, comment, and CDATA section in the document. It can also minify XML back to a single line.
Is this XML formatter free?
Yes, completely free with no signup, no daily limit, and no watermark or credit line added to the output. Format as many documents as you need.
What is the maximum file size?
5 MB per document, roughly 150,000 lines of typical XML. A 2 MB file formats in well under a second on an average laptop. Above 5 MB the tool asks you to split the document to avoid freezing the browser tab.
Does the XML formatter validate my document?
Yes — every document is checked for well-formedness as it is formatted. If there is a syntax error, the status bar reports the error type, line number, column, and the offending source line. For a validation-focused workflow, see the XML validator page.
Is my XML uploaded to a server?
No. The parser and formatter run entirely in JavaScript inside your browser tab. Nothing is sent over the network, which also means formatting keeps working after you go offline.
Does it preserve attributes, CDATA, and namespaces?
Yes. Attribute order, quote style (single or double), CDATA sections, processing instructions, the XML declaration, DOCTYPE, entities, and namespace prefixes are all kept exactly as written. Re-formatting a document changes its indentation and nothing else.
Can I format SVG, RSS, SOAP, or Maven pom.xml?
Yes. Every XML dialect is formatted the same way — SVG artwork, RSS and Atom feeds, SOAP envelopes, WSDL, XSD schemas, Android layouts, .plist files, and more. Fragments with multiple root elements are formatted too, instead of being rejected.
How is this different from xmllint --format?
xmllint is a command-line tool that requires installation and sometimes a package manager. This formatter runs in the browser with zero setup — paste your XML and get the result. It also preserves attribute order and quote style, which xmllint may normalize.
Why another XML formatter?
Most online XML formatters either reject fragments, normalize attribute quotes, or reorder attributes alphabetically. This one does none of that. The custom parser preserves everything about your document except its indentation: attribute order, quote style, CDATA sections, processing instructions, entities, and namespace prefixes survive intact.
Errors are actionable. Instead of a generic “parse error” you get line 14, column 7, mismatched closing tag </item> together with the source line itself. For a workflow centered on finding and fixing errors, see the XML validator.
The formatter runs in JavaScript inside your browser — no server round-trip, no file size quota, and no data leaves your machine. Once the page has loaded, it works offline too. Need to go the other way? The XML minifier collapses your document to a single line.
Where your XML is processed
Everything happens in the browser tab you are reading this in. The document you paste is parsed and re-printed by JavaScript on your own machine and is never uploaded, logged, or stored — which is also why the formatter keeps working after you disconnect from the internet.