About XML Formatter
XML is strict enough that one unclosed tag or a stray ampersand can make a whole document unusable, yet it is often written and delivered without indentation. This formatter parses the document, checks that it is well formed and prints it with the indentation you choose, so element structure, attributes and nesting are readable at a glance. Declaration, comments, CDATA sections and attribute order are preserved as written.
Validation uses the browser's own XML parser rather than a simplified check, so the reported problem is the one a real parser hit. Errors include the parser message and, where the browser provides it, the line and column of the failure. Everything runs in the tab: the document is never uploaded, no request is made and closing the page discards the input and output.
What this tool does
Three indentation styles
Pretty-print with two spaces, four spaces or tabs, and switch styles without re-pasting the document.
Minify without losing content
Remove indentation and the whitespace between elements while keeping text nodes, comments, CDATA and the declaration intact.
Well-formedness check
The document is parsed with DOMParser, so mismatched tags, bad attributes and invalid characters are reported before you ship the file.
Declaration and attributes preserved
The XML declaration, comments, CDATA sections, namespaces and attribute values are kept exactly as written.
Errors with line and column
A failed parse shows the parser message and the line and column reported by the browser, instead of a generic invalid-XML warning.
Copy and download, no upload
Copy the formatted XML or download it as an .xml file; the document stays on your device the whole time.
How to use XML Formatter
- 01
Add your XML
Paste the document into the input pane or load a .xml file from your device; files up to 10 MB are accepted.
- 02
Choose an indentation
Pick two spaces, four spaces or tabs. The choice applies to the formatted output only, never to the text content.
- 03
Format the document
Press Format. The XML is validated first, then printed with one element per line and clear nesting.
- 04
Validate or minify when needed
Use Validate to check well-formedness without changing the output, or Minify to collapse the document onto fewer lines.
- 05
Review, copy or download
Check the result in the output pane, then copy it or download a .xml file named after the uploaded document.
Supported formats and limits
- Input
- XML
- Output
- XML
- Processing
- Client-side, in your browser. Nothing is uploaded.
- Maximum size
- Bound by the memory available to your browser tab.
- Requirements
- Chrome, Edge, Firefox or Safari · JavaScript enabled
Limitations worth knowing
- Well-formedness only: no XSD, DTD, Relax NG or Schematron validation.
- Line and column come from the browser parser and can be missing or phrased differently between browsers.
- Mixed content is kept inline so text spaces are preserved, which can leave long lines in documents that mix text and elements.
- Input is capped at 10 MB of text and formatting runs on the main thread after a short yield.
Privacy and file handling
Your XML is parsed, validated and formatted entirely inside this browser tab. The document is never uploaded to FormatFlow or anyone else, no copy is stored and nothing leaves your device; closing the page clears the input and the formatted result.
Read the full privacy policy
