Genesis Forge
Genesis Forge › Free tools › Developer tools

XML formatter

Check that XML is well-formed and indent it for reading, or remove whitespace to minify it. Runs in your browser.

Runs in your browser. Nothing you enter is uploaded.

What it does

Paste XML, such as an Android resource file, an RSS feed or a sitemap, to check that it is well-formed and to lay it out with one element per line. Minify removes the spacing between elements.

How to use it

  1. Paste the XML.
  2. Choose the indent.
  3. Press Format or Minify. If the XML is not well-formed, the parser’s error is shown instead.

Worked example

<resources><string name="app_name">Kinvale</string></resources> becomes:

<resources>
  <string name="app_name">Kinvale</string>
</resources>

How it works

The text is parsed with the browser’s DOMParser in strict XML mode, then written back element by element. Elements that contain only text stay on one line. Comments, CDATA sections and processing instructions are kept.

Questions

What does well-formed mean?

Every tag is closed, tags are properly nested, attribute values are quoted and there is exactly one root element. It does not check the document against a schema.

Does formatting change the meaning?

Whitespace between elements is changed. That is harmless for most data formats, but it can matter in documents where mixed text and elements are significant.

Is the XML declaration kept?

Yes, if the input has one.

Is my text sent to a server?

No. Everything runs in your browser. Nothing you type is uploaded or stored by us.

Related tools

All free tools →