Tools

Free Online XML Formatter, Validator & Beautifier

Paste minified or messy XML and get it indented and readable in one click. The formatter validates as it parses, points at the first syntax error, and can minify the document again or convert it to JSON — all inside your browser.

Your XML never leaves this page: parsing, formatting and conversion all run in your browser, with no upload and no server-side logging.

What an XML Formatter Does

An XML formatter re-indents a document so its nesting becomes visible: every child element is pushed one level in from its parent, and elements that hold only text stay on a single line. Machine-generated XML — SOAP envelopes, RSS feeds, sitemaps, Android layouts, Maven POMs — usually arrives as one enormous line, which is fine for a parser and unreadable for a person. Formatting changes only whitespace between tags, so the document that comes out is the same document that went in.

How to Format XML Online

Four steps, no account and no upload:

  1. Paste your XML into the left panel, or load the sample to try the tool.
  2. Pick an indentation width — 2 spaces, 4 spaces or a tab character.
  3. Press Format. Invalid XML is rejected with the parser's own error message instead of a silent half-result.
  4. Copy or download the result, or switch to the second tab to convert the document to JSON.

Well-Formed vs Valid XML

Well-formed

The document follows XML syntax: one root element, every tag closed, tags nested in order, attribute values quoted, and reserved characters escaped. This is what a parser checks, and it is what this tool reports on.

Valid

The document is well-formed and also matches a schema — a DTD, XSD or RELAX NG grammar that says which elements may appear where. Validity needs that schema, so it is checked by your build or your editor, not by a browser-side formatter.

Common XML Errors and How to Fix Them

  1. Unclosed or mismatched tags — <item> closed by </Item>. XML is case-sensitive, unlike HTML.
  2. More than one root element. Wrap the siblings in a single container element.
  3. Raw & < or > inside text or attributes. Escape them as &amp; &lt; &gt; or wrap the text in CDATA.
  4. Unquoted attribute values. Every attribute needs quotes: id="1", never id=1.
  5. An undeclared namespace prefix, such as soap:Body with no xmlns:soap declaration on an ancestor.

Frequently Asked Questions

Yes. There is no account, no sign-up, no usage cap and no watermark on the output. The page is supported by advertising only.

No. Parsing, indenting, minifying and the XML-to-JSON conversion all happen in your browser through its built-in XML parser. Nothing is transmitted, stored or logged, which is why the tool also works on documents you are not allowed to paste elsewhere.

Only the whitespace between tags. Element names, attributes, text content, comments and CDATA sections are preserved. Whitespace inside a text node is significant in some XML dialects, so re-indent with that in mind if your schema uses xml:space.

No. The tool reports whether the document is well-formed — correct XML syntax. Checking it against a schema requires that schema file, which is a job for your editor or build pipeline.

Documents of a few megabytes format in well under a second on a normal machine. Very large files are limited by your browser's memory rather than by the tool, since everything is held client-side.

Attributes are prefixed with @, mixed text content lands under #text, and repeated sibling elements with the same name collapse into an array. That is the conventional mapping, and it keeps the structure predictable when you read the result back.