Skip to content
gohacks.dev
Web

XML Formatter and Validator

Pretty-print or minify XML and check that it is well-formed, using the browser's own XML parser, with comments, CDATA and the declaration kept.

Free · No sign-up · Your inputs stay in your browser

Input

Format and validate XML

Output

Not well-formed

DOMParser is not defined

Checked with the browser's own XML parser, which reports the first error and its line. Well-formed is not the same as valid: validating against an XSD or DTD needs the schema, which this does not fetch.

Runs in this browser. Nothing you paste is sent to a server.

Well-formed or valid

Well-formed XML follows the syntax rules of XML 1.0: one root element, every tag closed, attributes quoted, special characters escaped. Valid XML is also well-formed and matches a DTD or XSD that says which elements are allowed where. This tool checks the first; validating needs the schema.

The usual errors

An unescaped & in a URL (write &), a tag closed in the wrong order, and text before the XML declaration, which must be the very first thing in the file, account for most parse errors in sitemaps and feeds.

Share

Frequently asked questions

Why does my sitemap fail with 'EntityRef: expecting ;'?
A URL contains a bare &. In XML it must be written &, so ?a=1&b=2 becomes ?a=1&b=2.
Does formatting change the meaning of the XML?
Whitespace between elements is usually insignificant, but inside mixed content or xml:space="preserve" it is data. Check before reformatting documents like that.
Is what I paste sent anywhere?
No. The tool runs entirely in your browser with JavaScript. Nothing you type or paste is sent to our server or stored.

Keep planning

Similar tools