XML Formatter
Pretty-print and validate XML with syntax highlighting. Also minifies to a single line.
About the XML Formatter
XML (Extensible Markup Language) is widely used in enterprise systems, APIs, configuration files, and data exchange formats like RSS, SOAP, and SVG. Raw XML from APIs or log files is often a single unreadable line. This formatter pretty-prints it with consistent indentation and validates the structure at the same time.
Features
- Format with 2 spaces, 4 spaces, or tab indentation
- Minify XML to a single line
- Syntax highlighting for tags, attributes, and comments
- Validation via the browser's DOMParser — catches malformed XML
Frequently Asked Questions
Does this validate XML?
Yes. The browser's DOMParser parses your XML. Malformed XML shows an error with the problem location.
What about namespaces?
Namespace prefixes and attributes are preserved in the formatted output.
Can I minify XML?
Yes — the Minify button collapses all whitespace between tags. Valid XML, same as the original but without formatting.