XML Formatter
Pretty-print or minify XML, check well-formedness with line and column errors, and explore a tree view — CDATA and namespaces handled in your browser.
Loading tool controls…
Verify it yourself: press F12, open the Network tab, and use this tool — your files are never uploaded.
XML Formatter at a glance
- Price
- Free
- Account
- Not required
- File uploads
- None — your files are never uploaded
- Category
- Developer Tools
Who uses Developer Tools?
Developers and engineers formatting JSON, testing regex, hashing data, encoding values or building API requests.
How to Use XML Formatter
Follow these simple steps to get instant results in your browser.
Paste Your XML
Paste XML into the box — or use the sample, a small book catalog with a namespace and a CDATA section.
Pick Pretty or Minify
Choose pretty-print for reading, or minify for the smallest file. Minify can also strip comments.
Check and Explore
If the XML is not well-formed, the line and column of the error are shown. If it is, copy the result or open the tree view.
What is XML Formatter & How Does It Work?
XML Formatter pretty-prints or minifies XML and checks that it is well-formed, with the line and column of the first error when it is not. Pretty-printing adds indentation and line breaks so the structure is readable; minifying strips the whitespace between tags (and optionally comments) to make the file as small as possible. Neither changes the data — only the whitespace.
Well-formedness is checked by the browser's native DOMParser — the same parser every browser uses — so CDATA sections and namespaces are handled exactly as the browser parses them. A namespaced element such as <bk:book> formats and appears in the tree view with its prefix, and a CDATA section such as <![CDATA[Special <offer> & more]]> is kept as-is.
The tree view turns the document into a collapsible outline: each element shows its attributes and text, so you can explore a large document without scrolling through raw markup. This checks well-formedness only — matching tags, one root, quoted attributes — not validation against an XSD schema or DTD, and the page says so.
Key Features & Capabilities
Pretty-Print and Minify
Readable indentation or the smallest possible file, from the same input.
Line and Column Errors
Well-formedness failures are reported with the parser's exact line and column.
Collapsible Tree View
Explore the document as an outline of elements, attributes and text.
CDATA and Namespaces
CDATA sections and namespaced elements are preserved and parsed correctly.
Private by Design
Parsing runs in your browser; your XML is never uploaded.
Pro Tips
- •Bookmark this tool for instant one-click access anytime.
- •Drag and drop files directly onto the input surface for fastest handling.
- •All processing happens in your browser session for maximum speed and data safety.
🎯 Common Use Cases
Sources & Further Reading
- Extensible Markup Language (XML) — W3C
- XML 1.0 Specification — W3C
- DOMParser — MDN Web Docs
Frequently Asked Questions about XML Formatter
Frequently asked questions
More Developer Tools
Complementary utilities for your workflow
XML Formatter
Pretty-print, minify and validate XML, with a tree view.