XML formatter and validator

Paste XML to check it and lay it out with one element per line and consistent indentation, such as a Maven pom.xml, an Android layout, a SOAP message, an SVG or an RSS feed. Minify puts it on one line.

Only the layout changes

Text, attribute values, entities such as &, comments and CDATA sections are kept exactly as written; only the whitespace between elements changes. An element with text in it, or marked xml:space="preserve", is left as it is, because whitespace in text can matter.

Long tags and attribute order

A start tag too long for one line gets one attribute per line. Sort keys orders the attributes of every element alphabetically, with namespace declarations first; the order of elements is kept, as it matters in XML.

Well-formed or not

The text is checked as you type: a closing tag that does not match, an element never closed, a "&" that should be &, an attribute without quotes. Each problem is explained with its line and column.

Keyboard shortcuts

  • Format: Shift+Alt+F (⌥⇧F on a Mac)
  • Minify: Shift+Alt+M (⌥⇧M on a Mac)
  • Undo: Ctrl+Z (⌘Z on a Mac). Each Format or Minify is a step of its own.
  • Find and replace: Ctrl+F (⌘F on a Mac)

Private: nothing is uploaded

Formatting, checking and comparing all happen in your browser. Your documents are saved in the browser's own storage on this computer, not on a server, so they never leave your device.

With your permission, we count anonymous visits (which pages and tools are used), never what you type. See Privacy.

Questions

How do I check whether XML is valid?

Paste it in: it is checked as you type, and anything that makes it not well-formed is underlined and explained with its line number. Checking against a schema (XSD) is not done.

Does minifying change my XML?

It removes the whitespace between elements, and comments. Text inside elements, attribute values and CDATA stay exactly as they are.

Can I format HTML here?

Only XHTML, which is XML. HTML allows tags such as <br> without a closing tag, which XML does not; the error says so and how to write it instead (<br/>).

Is my data uploaded anywhere?

Your documents aren't: everything runs in your browser, and they are saved on your computer, in the browser's storage for this site. With your permission we count anonymous visits, never their content.

More tools