XML formatter

Pretty-print or minify XML, with indentation control and a well-formedness check. Runs in your browser; nothing is uploaded.

Formatted XML

About this tool

XML formatter cleans up XML two ways:

It also checks well-formedness: if the XML has a mismatched tag or a syntax error, you get a clear message with the byte position instead of broken output.

Privacy

Everything runs in your browser via WebAssembly — your XML is never uploaded to a server. You can also run it from the gizza CLI or inside a gizza chat.

Common uses

FAQ

Does it validate my XML against an XSD schema or DTD?

No — it checks well-formedness only: balanced tags, proper nesting, legal syntax. That's enough to catch a missing closing tag or an unescaped &, but it doesn't know anything about your schema, so structurally "wrong" but well-formed documents format without complaint.

What does "XML is not well-formed at byte N" point at?

N is the byte offset where the parser gave up — count bytes from the start of your input (multi-byte UTF-8 characters count more than one). The usual culprits are a mismatched or unclosed tag, an attribute missing its quotes, or a bare & that should be &.

Are comments, CDATA sections, and the XML declaration kept?

Yes. The formatter re-emits every parsed event — comments, <![CDATA[…]]> sections, processing instructions, and the <?xml …?> declaration all pass through in both pretty and minify modes; only the whitespace between elements changes.

How much can I indent, and does minify use the indent value?

Pretty mode indents 0–16 spaces per level (default 2); values outside that range are clamped. Minify ignores the indent entirely — it collapses insignificant whitespace so the document comes out as a single compact line.

Developer & Automation Access

Run it from the terminal

Same engine as this page, headless — via the gizza CLI:

gizza tool xml-formatter "<root><item>value</item></root>"

New to the CLI? Get gizza →

Open it by URL

Pre-fill and auto-run this tool with query parameters — the names match the API/CLI:

https://gizza.ai/tools/xml-formatter/?xml=%3Croot%3E%3Citem%3Evalue%3C%2Fitem%3E%3C%2Froot%3E&mode=pretty&indent=2

Machine-readable descriptor: tool.json — title + parameters JSON Schema for agents.