Developer utility

XML Formatter

Validate, format, minify, inspect, and copy XML with parser feedback, readable output, tree view, element paths, and structure statistics directly in your browser.

Input

Paste XML

Validation Waiting

Paste XML to validate, format, minify, and inspect structure.

Size0 B
Elements0
Attributes0
Depth0

Output

Formatted or minified XML

Tree view

XML structure

Paths

Element paths and attributes

#PathElementAttributesText preview

Examples

Common XML samples

XML quick reference

ConceptExampleNotes
Root element<root>...</root>XML documents need one root element.
Attribute<item id="1">Attribute values must be quoted.
Text node<title>Hello</title>Text appears between start and end tags.
Comment<!-- note -->Comments can be preserved or removed during formatting.
CDATA<![CDATA[raw text]]>CDATA keeps text unescaped.
Declaration<?xml version="1.0"?>Common at the top of XML files.

XML formatting notes

  • XML is stricter than HTML: tags must be closed and nested correctly.
  • Attribute values must use quotes, and a document must have exactly one root element.
  • Formatting changes whitespace around tags; avoid it for XML where whitespace-only text nodes are meaningful.
  • The parser uses the browser DOMParser, so validation follows the browser XML parser behavior.

XML formatter FAQ

Is this XML formatter private?

Yes. XML parsing, formatting, minifying, and tree inspection happen locally in your browser.

Can it repair broken XML?

No. It reports parser errors so you can fix the source without the tool guessing and changing meaning.

Can I use it for SVG or RSS?

Yes. SVG, RSS, Atom, sitemap XML, and many config files are XML-based and can be inspected here.