Skip to content
Esc

XML formatter

Text never leaves this browser

Paste XML or drop a .xml file to pretty-print it, minify it, or see the first well-formedness error. Comments and CDATA stay in the document, and nothing is uploaded.

Output
Indent

How to use it

  1. Paste XML, drop a .xml or .txt file, or try the sample catalog.
  2. Choose pretty-print (2 spaces, 4 spaces, or tabs) or minify. The result updates as you type; errors show the line and column.
  3. Copy the result or download it as a .xml file. If you dropped several files, download a ZIP of every formatted file.

Details

Well-formedness
The checker looks for mismatched tags, unquoted attributes, unknown entities, and similar markup errors. It does not validate against an XSD or DTD
Kept as-is
Comments, CDATA, the XML declaration, and a DOCTYPE (if you include one) are preserved. External entities are not loaded
Pretty or minify
Pretty-print indents element-only content and leaves mixed text (for example a paragraph with a link) on one line. Minify removes those extra line breaks
Entities
The five built-in XML entities (< > & ' ") and numeric character references are understood

Questions

Are my files uploaded?

No. The page loads its code once, then reads and processes your files inside the browser tab. Nothing is sent to a server; you can confirm it in your browser's network panel while a file is processed.

Does this validate my XML against a schema?

No. A well-formedness check only asks whether the markup is legal XML: tags nest, attributes are quoted, and so on. Schema or DTD validity (whether the document matches a particular vocabulary) is a different job and is not run here.

Will my comments and CDATA be deleted?

No. Comments and CDATA sections are kept. In pretty-print, comments between elements get their own indented line.

Why is “fish & chips” rejected?

A bare ampersand is illegal in XML text. Write fish & chips, or put the text in a CDATA section. The error message points at the line and column of the first problem.

Is my XML sent to a server?

No. Formatting and the well-formedness check run in this tab. You can confirm it in your browser’s network panel while you paste or drop a file.