JSON Formatter
Pretty-print, validate and minify JSON with precise error positions.
Developer & Security
Pretty-print, minify and check XML is well-formed.
Well-formed means the syntax holds together: one root element, every tag closed, correct nesting, attributes quoted. That is what this tool checks.
Valid means the document also conforms to a schema — a DTD, XSD or RelaxNG — which specifies which elements may appear where, and what types their values take.
A document can be perfectly well-formed and still be rejected by the system expecting it, because it puts the right syntax in the wrong shape. If a payload is refused despite formatting cleanly, the schema is where to look.
Between elements, whitespace is usually ignorable, so indentation can be added and removed freely. Inside a text node it is content, and reflowing it changes the data.
The exception is xml:space="preserve", which explicitly marks a section whose whitespace must survive untouched.
This is why formatting a document containing embedded code, poetry or pre-formatted text can silently corrupt it. This tool indents structure without reflowing text nodes, but a document relying on significant whitespace is worth checking after any reformat.
| Character | Entity | Required |
|---|---|---|
| & | & | Always |
| < | < | Always |
| > | > | In content, by convention |
| " | " | Inside double-quoted attributes |
| apostrophe | ' | Inside single-quoted attributes |
An unescaped ampersand is the single most common cause of an XML parse failure, because it appears constantly in URLs. A query string dropped into an element without escaping breaks the document at the first parameter separator.
Well-formed means the syntax holds together — one root, tags closed, correct nesting, attributes quoted. Valid means it also conforms to a schema. A document can be well-formed and still rejected for having the wrong shape.
It changes whitespace between elements, which is normally insignificant. Text inside elements is content and is not reflowed. Sections marked xml:space="preserve" need care after any reformat.
An unescaped ampersand is the most common cause, because URLs are full of them. A raw ampersand must be written as an entity, along with the less-than sign inside content.
No. Exactly one root element is required, and multiple top-level elements are the second most common well-formedness failure after unescaped ampersands.
No. Parsing and formatting run in your browser, which matters because the XML people format is usually a config file, an invoice or an API payload.