Format and validate XML online. Errors explained in plain English and fixed in one click. Free, no ads, runs in your browser.
The formatter indents one-line or messy XML, checks that it is well-formed, and when it finds an error it explains it in plain English, points to the exact spot and offers a fix. It keeps the XML declaration, DOCTYPE, CDATA, namespaces and comments.
Copy XML from an API, an export or a config file, drop a file (SVG, XSD, WSDL too), or click Sample.
Indent with 2 or 4 spaces or tabs. Ctrl+Enter formats, Ctrl+Shift+Enter minifies, Ctrl+G jumps to a line.
Each error shows the line and column with an arrow and a fix button. “Fix everything” applies all safe fixes at once.
The most common reasons XML won’t load — with the messages parsers print. If you got one of these, paste your XML above.
Fine in HTML, but in XML every attribute value must be quoted.
<book id=bk101>→<book id="bk101">AttValue: " or ' expected (libxml2 (Chrome, PHP)), not well-formed (invalid token) (Python (expat))& starts an entity; on its own it must be written as &.
Tom & Jerry→Tom & JerryxmlParseEntityRef: no name (libxml2 (Chrome, PHP)), not well-formed (invalid token) (Python (expat))< starts a tag; in text write <.
<a>1 < 2</a>→<a>1 < 2</a>StartTag: invalid element name (libxml2 (Chrome, PHP))An element is closed by a different tag than it was opened with — a missing end tag or a typo.
<a><b></a>→<a><b></b></a>Opening and ending tag mismatch: b line 1 and a (libxml2 (Chrome, PHP)), mismatched tag (Python (expat))XML knows only 5 entities; others must be numeric.
price 100→price 100Entity 'nbsp' not defined (libxml2 (Chrome, PHP)), undefined entity (Python (expat))XML may have only one root — typically concatenated files or a fragment of a larger document.
<a/><b/>→<root><a/><b/></root>Extra content at the end of the document (libxml2 (Chrome, PHP)), junk after document element (Python (expat))An element uses the prefix x: but xmlns:x is not declared.
<a><x:b/></a>→<a xmlns:x="urn:x"><x:b/></a>Namespace prefix x on b is not defined (libxml2 (Chrome, PHP)), unbound prefix (Python (expat))The document ends before all elements are closed.
<a><b>→<a><b></b></a>Premature end of data in tag b line 1 (libxml2 (Chrome, PHP)), no element found (Python (expat))…and more: attributes without a value (<input checked>), duplicate attributes, whitespace before <?xml ?>, “--” in comments, control characters, missing space between attributes.
Correctly structured XML: matching tags, quoted attributes, a single root element and escaped special characters. Validation against a schema (XSD) is not performed.
Browsers forgive HTML mistakes, XML parsers don’t — a single & or an unquoted attribute is enough. The formatter points to the exact spot.
Yes. Comments can be dropped with an option; CDATA, the declaration, DOCTYPE and namespaces are kept.
Yes. No sign-up, no ads and no size limit — the only limit is your computer.
No. Everything runs in your browser and the data you paste never leaves it — fine even for data with tokens or personal information.