XML Formatter

Pretty-print, minify and validate XML in your browser with helpful syntax errors. Copy or download the result.

Runs entirely in your browser — no uploads

About this tool

XML Formatter parses your markup with the browser’s own XML engine, reporting precise line/column errors when something is malformed, then pretty-prints with configurable indentation or minifies to one line.

Processing is entirely local — appropriate for internal configs, sitemaps and API payloads.

How to use it

Paste your XML into the input, choose an indentation width, and format to get a readable, properly nested document. If you need a compact payload instead, use minify to strip the whitespace into a single line. When the input is malformed, the parser reports the line and column where it stopped and a short explanation, so you can jump straight to the problem.

What the parser accepts

Formatting uses your browser’s built-in XML parser, which understands namespaces, attributes, CDATA sections, comments, and processing instructions. Because it is a real XML parser rather than a string-based indenter, output is only produced when the document is genuinely well formed. That strictness is useful: it catches an unclosed tag or an invalid entity before you ship a config file.

Typical uses

Read a machine-generated sitemap or SOAP response, tidy up an SVG that was exported on one line, review an RSS feed, or make a configuration file reviewable in a pull request. Minified output is handy when you need to paste a small document into a command line or a URL parameter.

Limitations

XML is strict: every opening tag needs a matching close, attributes need quotes, and HTML habits such as a bare <br> or an unescaped ampersand will fail. This tool checks well-formedness, not validity against a DTD or XSD, so a document can parse cleanly while still having the wrong elements. External entities are not fetched. Nothing is uploaded, so internal configs are safe to paste.

Free · no account No file uploads Works on mobile

FAQ

Which XML features are supported?
Namespaces, attributes, CDATA, comments and processing instructions — whatever DOMParser handles, which is the full XML spec.
Why did my HTML-ish input fail?
The parser is strict XML: every tag must close, entities must be valid. HTML tolerance like unclosed
tags will error.
Is my XML sent anywhere?
No. Parsing happens with your browser’s built-in DOMParser, fully offline.