99+ Free Tools
← Back to all tools

XML Formatter

Pretty-print and validate XML — with the exact error line when it is wrong. Nothing is uploaded or stored.

Code on a screen
Very large XML (over 5 MB) may be slow; namespaces are preserved but not validated against schemas.

Format

Paste XML first.

Result

The formatted XML will appear here.
Root element—
Elements—

Tree view — click a node to collapse or expand it

The tree will appear here.

XML to JSON (basic)

The JSON conversion will appear here.
How the formatter works

Parsing. The XML is read token by token — declarations, comments, CDATA, tags and text — and checked as it goes, so a mismatched tag is reported with its exact line.

Formatting. Elements with only text stay on one line; everything else gets its own line at the chosen indent. Content is never changed, only whitespace between tags.

Local only. All work happens in your browser. Nothing is uploaded, stored or shared.