Skip to content

XML Formatter & Validator

Indents XML and reports the line and column of the first well-formedness fault.

Indents an XML document — a SOAP envelope, an RSS feed, an SVG, a `.xsd` — and reports whether it is well-formed while doing so. Well-formed means the tags match, the attributes are quoted and every namespace prefix is declared; it does not mean the document satisfies your schema.

🔒 Runs entirely in your browserxmlformatvalidatexsd
Indent

XML in

Drop an XML file

Read in this tab. Nothing is uploaded.

Formatted

Well-formed. Every tag closes, every attribute is quoted, and every namespace prefix is declared.

Elements

10

Attributes

8

Depth

5

In

361 byte

Out

428 byte

This checks that the document is well-formed — tags match, attributes are quoted, namespace prefixes are declared — and it does not validate against a DTD or an XSD. An element that is well-formed can still be in the wrong place for your schema, and this will not tell you so. An element containing both text and child elements is left on one line: reindenting it would insert whitespace into your content.

How to use it

  1. Paste or drop the document

    XML, SVG, XSD, RSS and Atom are all accepted. The stats line counts elements, attributes and nesting depth as you type.

  2. Set the indent, or minify

    Two spaces, four, or a tab; or flip to Minify when the document is going over a wire that charges by the byte.

  3. Sort attributes when you are diffing

    XML gives attribute order no meaning, so two documents that differ only in it produce a noisy diff. Sorting them makes the real difference visible.

  4. Read the problems, if there are any

    Errors and warnings come with a line and column. The document is still formatted as far as it can be, so you can find the fault by looking at where the output stops making sense.

Common questions

Does it validate against my XSD or DTD?

No. It checks well-formedness only. An element that is perfectly well-formed can still be in the wrong place, have the wrong cardinality or carry the wrong type for your schema, and nothing here will tell you so.

Why was one element left on a single line?

Because it contains text and child elements together — `<note>Deliver <em>before</em> Friday</note>`. Indenting that would insert whitespace into your content, and in mixed content whitespace is content.

Can I format an SVG with it?

Yes — an SVG is XML, and path data lives in an attribute so it is never reflowed. For editing the path itself, the SVG path tools are the right page.

Does it expand entities from a DTD?

No. Only the five XML predefines are understood; a custom entity declared in an internal or external DTD subset is left as written. Resolving external ones would mean fetching a URL, which this page does not do.

Feed it from

Next

These accept what this tool produces, so the result can go straight in.