Free online XML formatter and validator
Format XML in seconds, up to 5 MB
Format XML is a free online XML formatter that turns minified or badly indented markup into a cleanly nested document as you paste it. It takes documents up to 5 MB, indents with 2 spaces, 4 spaces, or a tab, minifies XML back to a single line, and names the exact line and column of the first syntax error — with no signup and nothing to install.
- 100% free
- No signup
- Up to 5 MB
- Beautify or minify
- Error line + column
The formatted result appears here.
Paste XML, drop a file, or press Ctrl+V anywhere on this page.
How to format XML
Three steps, a few seconds, no signup and nothing to install.
Paste or drop your XML
Paste the markup straight into the left panel, press Ctrl+V (⌘V on a Mac) anywhere on the page to pull an .xml file off the clipboard, or drag a file onto the editor. Documents up to 5 MB are accepted, and .xsd, .xsl, .svg, .rss and other XML dialects load the same way.
Pick beautify or minify
Beautify re-indents the whole tree with 2 spaces, 4 spaces, or a tab. Minify does the opposite and returns the document as a single line. Tick "Strip comments" to drop every <!-- … --> block from either result.
Copy or download the result
The right panel refreshes as you type. Press Copy to put the result on your clipboard, or Download to save it as an .xml file. If the markup is not well-formed, the bar below names the line and column that need fixing instead.
Technical specifications
| Accepted input | Any well-formed XML — .xml, .xsd, .xsl/.xslt, .svg, .rss, .atom, .wsdl, .kml, .plist, .config, pom.xml |
|---|---|
| Output | Beautified XML (2 spaces, 4 spaces, or tab) or minified to one line |
| Maximum document size | 5 MB, about 150,000 lines |
| Validation | Well-formedness check reporting the line and column of the first error |
| Kept exactly as written | XML declaration, DOCTYPE, CDATA, comments, entities, namespace prefixes, attribute order and quote style |
| Processing location | Your browser — the XML is never uploaded to a server |
| Price | Free, no signup, no limit on the number of documents |
| Works offline | Yes, once the page has loaded |
Frequently asked questions
How do I format XML online?
Paste your XML into the left panel and the formatted version appears on the right straight away. Pick 2-space, 4-space, or tab indentation in the toolbar, then press Copy or Download. There is nothing to install and no account to create.
Is this XML formatter free to use?
Yes — free, with no signup, no daily quota, and no watermark or credit line added to the output. You can format one document after another for as long as you like.
Will it tell me if my XML is invalid?
Yes. Every paste is checked for well-formedness and the first problem is reported with its line and column: mismatched closing tags, tags that are never closed, unquoted or missing attribute values, duplicate attributes, and unterminated comments or CDATA sections. The status bar also prints the offending source line so you can spot the typo without hunting for it.
How do I minify XML instead of indenting it?
Flip the toolbar toggle from Beautify to Minify. Every line break and indent is removed and the document comes back as one line, which typically cuts 20-40% off an indented file. Single spaces between text and inline tags are kept, so mixed content still reads the same.
What is the largest XML file I can format here?
5 MB per document, which is roughly 150,000 lines of ordinary markup. A 2 MB file is parsed and re-indented in well under a second on an average laptop. Above 5 MB the tool asks you to split the document rather than freezing the tab.
Can I paste an XML file instead of choosing one?
Yes. Copy the file in Finder or Explorer and press ⌘V or Ctrl+V anywhere on this page — it is read and dropped into the editor, and a clipboard file that arrives without a name is saved as pasted-1.xml. Dragging the file onto the editor and the "Open file" button do the same job. Copy several files at once and the first XML one wins, since a formatter works on a single document at a time.
Is my XML sent to a server?
No. The parser and the printer are plain JavaScript running inside your own tab, so the markup is never uploaded anywhere. A side effect worth knowing: once this page has loaded, formatting keeps working with the network switched off.
Does it handle SVG, RSS, SOAP, and pom.xml?
Yes, every XML dialect is treated the same way — SVG artwork, RSS and Atom feeds, SOAP envelopes, WSDL, Maven pom.xml, XSD schemas, Android layouts, and .plist files. The XML declaration, DOCTYPE (including an internal subset), processing instructions, CDATA, comments, entities, namespace prefixes, attribute order, and even single-quoted attribute values all survive untouched. Fragments with several root elements are formatted too, instead of being rejected.
About this tool
Format XML exists for the moment you open a config file, a SOAP response, or an API payload and find the whole thing on one endless line. Paste it here and it becomes a readable tree; paste a readable tree and Minify hands it back compact for a request body or a fixture file.
The parser is written for this site rather than borrowed from the browser, which buys two things the built-in one will not give you. Errors carry a position: instead of “parse error” you get line 14, column 7, mismatched closing tag </item> together with the source line itself — see the dedicated XML validator for a validation-first workflow. You can also use the XML formatter page if you arrived here searching for that term, the online XML formatter for a browser-only workflow, or the XML minifier to compress XML to a single line. And fragments are welcome — markup with two or more root elements, the shape you get from copying half a file, is formatted rather than rejected.
New to XML? Read our guide on what XML format is — it covers the syntax rules, where XML is still used, and common mistakes to avoid. Need to turn XML into a spreadsheet? See how to convert XML to CSV. Working with XML embedded in PDFs? Our guide on the PDF XML format explains XFA forms, XMP metadata, and how to extract and format the XML.
Round-tripping is deliberate. Attribute order and single-quoted values are kept as you wrote them, entities such as & are never re-escaped, and CDATA sections are copied through byte for byte, so re-formatting a document changes its layout and nothing else.
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 tool keeps formatting after you disconnect from the internet.