XML Formatter & Validator

Formats, validates and minifies XML in real time, with clear syntax-error diagnostics.

Mode

Indentation

What is XML

XML (Extensible Markup Language) is a text format for representing structured data using nested tags, like `<tag>content</tag>`, optionally with attributes. Unlike HTML, XML doesn't define a fixed set of tags — every document defines its own vocabulary, which is why it shows up in contexts as different as configuration files, RSS/Atom feeds, SOAP, SVG, and document formats like DOCX/XLSX (which are, underneath, compressed XML files).

What an XML Formatter is for

An XML Formatter organizes a minified XML into a readable, indented version that's easy to review — and, at the same time, validates whether the text is well-formed, pointing out exactly where it isn't.

Pretty Print

Pretty Print reorganizes the document's structure (elements, comments, CDATA sections) with consistent indentation. Elements that only contain text — or text mixed with other elements, like `<p>Hello <b>world</b>!</p>` — are preserved exactly as they are, on a single line: reformatting the whitespace inside that content would change the data itself, not just its appearance.

Minify

Minify strips all whitespace and line breaks used only for structure, shrinking the XML to its smallest possible size without changing the data itself. It's the ideal form for transmitting or storing XML, where every byte counts and human readability isn't the goal.

Validation

This tool validates whether the XML is well-formed — correct syntax: every opened tag is closed, attributes aren't repeated, there's exactly one root element. That's different from validating against a schema (DTD or XSD), which checks whether the document follows a specific vocabulary — that second kind of validation is out of scope for this tool (see Limitations, below).

Known limitations

This tool doesn't validate against a DTD or XSD — it only checks whether the XML is well-formed. Content-free elements are always normalized to the self-closing form (`<tag/>`), even if the input used `<tag></tag>`. Error diagnostics (line, column and likely cause) depend on the message format each browser uses internally — when no known format is recognized, the tool shows only the original message, without inventing a location. External documents referenced by a DOCTYPE are never downloaded by the browser (or by this tool) — see the security question below.

Frequently asked questions

No. All processing happens in your browser — the XML you paste here never travels over the internet and is never logged anywhere.

Format (Pretty Print) arranges the XML with indentation, for human reading. Minify removes all extra whitespace, for the smallest possible size — the same data, two representations.

The most common causes are a closing tag with no match, a tag that was opened and never closed, a repeated attribute on the same element, or more than one root element in the document. The tool points to line and column whenever the browser reports that position.

Not in this version. Validation here is well-formedness — correct syntax. Validating against a specific schema (DTD or XSD) checks whether the document follows a separately defined vocabulary, an extra layer this tool doesn't cover.

That's the self-closing form, equivalent to `<tag></tag>` and widely used in XML — the tool always normalizes content-free elements to this more compact form, regardless of how the input was written.

Yes. The browser's `DOMParser` never downloads or resolves external files referenced by a DOCTYPE (external DTD) — unlike some misconfigured server-side parsers, which are vulnerable to the so-called XXE attack. In the browser, that class of risk simply doesn't exist.

File upload accepts up to 5 MB. Pasting directly into the text field has no technical limit, but very large files may slow the browser down.