Home/JSON & Markup Tools/XML formatter / validator

XML formatter / validator

XML Formatter and Validator

Built for fast checks, clean diffs, and reliable client-side parsing.

0 → 0 bytes Waiting
InputPaste XML
OutputFormats live as you type
Validates XML syntax instantly Pretty or minified output Optimized for long payloads

How it works

Parses your XML in the browser, validates structure, and either re-indents nodes or collapses spacing between tags for compact output.

  • Pretty mode uses 2-space indents, preserves attributes, comments, and CDATA.
  • Minify keeps text content intact; validation fails fast on malformed markup.

Quick examples

Pretty print
<note><body>Hi</body></note>
<note>
  <body>Hi</body>
</note>
Minify
<items> 
  <item id="2">B</item> 
</items>
<items><item id="2">B</item></items>

Paste or drop XML; formatting updates as you toggle modes.

Mini FAQ

Does it keep the XML declaration?

Browsers drop the declaration when serializing; output starts at the root element.

What happens to whitespace in text nodes?

Only empty text nodes are trimmed; meaningful spaces inside elements stay untouched.

Are processing instructions and comments preserved?

Yes, both modes keep processing instructions and comments intact.