XM

XML Formatter

Beautify, minify, and validate XML documents with proper indentation — processed entirely in your browser.

Indent:
Opens your print window: choose "Save as PDF". The file is named "XML Formatter - MondayTool".
About this tool

Last updated:

Beautify, minify and check XML

This XML formatter turns compact or messy XML into an indented, readable layout, or strips it down to a minified version. Before it does either, it checks that your XML is well-formed. Processing happens in your browser.

How to use it

  1. Paste your XML into XML Input. A sample is loaded to start with.
  2. Choose Beautify or Minify.
  3. For Beautify, set the Indent to 2 or 4 spaces.
  4. Click Beautify XML or Minify XML.
  5. Read the result in Output, then click Copy.

How it works

The tool first runs your text through the browser's own XML parser. If it finds an error, such as a missing closing tag or two root elements, it shows the message and produces no output. If the XML is well-formed, you see a green confirmation and the result.

What each mode does

ModeResult
BeautifyOne tag per line, indented by nesting level. Elements that contain only text stay on one line.
MinifyRemoves comments and the whitespace between tags. Text and CDATA sections are kept unchanged.

The output panel also shows the number of lines and tags.

Assumptions and limits

  • The check is for well-formedness only. It does not validate against an XSD or DTD.
  • Error messages come from your browser, so their wording can differ between browsers.
  • Beautify leaves the text inside elements as it is, apart from trimming the ends.
  • Minify deletes comments.

Frequently asked questions

Does it check my XML against a schema?

No. It only checks that the XML is well-formed: tags match, attributes are quoted and there is one root element.

Why do I get no output?

The input has an error. Fix the problem shown in the red box and run it again.

Is my XML sent to a server?

No. Parsing and formatting both run in your browser.

More to explore

Related Developer Tools

Browse all tools from the same category.

Showing 1-2 of 49