XML Formatter & Beautifier

XML Formatter & Beautifier

Free XML formatter, validator, and beautifier online — format, minify, tree view, XPath query, XML diff, and convert to JSON/CSV. 100% client-side, no signup.

Updated May 2026

Paste XML or load from URL to get started
Shift + Enter to Copy · Shift + for tabs
1

How to format XML online

Six tools, one paste box

1. Paste XML or fetch it from a URL

Validation runs instantly and flags the exact line if the document isn't well-formed.

2. Pick a tab

Format, Tree (collapsible view), XPath, Diff, or Convert (to JSON/CSV).

3. Copy or download

Copy to the clipboard, or Download to save the result as an `.xml` file.

What this XML formatter can do

Six features built into one tool

Formatting and minifying

Configurable indentation (2 or 4 spaces, or a tab), with the declaration and comments preserved.

Interactive tree view

Collapse and expand nodes to navigate documents with 10+ levels of nesting.

XPath querying

Type any XPath expression and see the matching nodes serialized back as XML.

XML diff

Normalizes both documents before comparing, so indentation differences never show up as false positives.

Convert to JSON/CSV

Export the XML structure to formats that are easier to consume in other tools or scripts.

Load from URL

Paste the URL of an RSS feed, sitemap, or API endpoint and click Fetch.

Examples

Operation
Result
Format: `<catalog><book id="bk101">...`
Indented with each tag on its own line
XPath: `//book[price > 10]`
Returns the full `<book>` element with its children
Convert: `<user id="42"><name>Alice</name></user>`
{"user":{"@id":"42","name":"Alice"}}

When you'll reach for this tool

The most common scenarios among people who use it

Debugging SOAP responses

Enterprise APIs return SOAP as a single line — format it to make sense of the envelope and body.

Reading RSS/Atom feeds

Load by URL to see how items are structured and which fields are actually available.

Maven and Spring configs

pom.xml and application context files nest deeply — the tree view makes them navigable.

Comparing API versions

Use Diff to see exactly what changed between two XML responses from an API.

Hit an error? Start here

Confusing well-formed with valid

Well-formed just means the basic syntax rules are followed. Valid also means the document obeys an external DTD or XSD.

Expecting namespaces to be stripped

Prefixes and xmlns declarations are preserved exactly as written — they're never rewritten.

A huge file freezing the browser

Above 10–20 MB, split the XML into smaller pieces or use xmllint from the command line instead.

Why use this XML formatter

It bundles six features into one place — formatting, minifying, tree view, XPath, diff, and conversion — instead of forcing you to juggle a separate tool for each operation.

Everything runs in the browser through the native DOMParser, which makes it safe for XML that contains credentials, internal SOAP payloads, or other sensitive configuration.

Well-formed XML vs. valid XML

Two different levels of conformance

Well-formed
Valid
Rules
basic XML syntax
well-formed + external DTD/XSD
Checked by
this tool, automatically
a dedicated XSD validation tool
Typical failure
an unclosed tag
an element outside the schema's defined structure

Frequently asked questions

It adds indentation and line breaks to make the markup readable — it doesn't touch the data itself. The formatted output is semantically identical to the original; only the whitespace changes.

References

Related Tools