Skip to content
utilhex

XML Formatter & Validator

Format, validate, and minify XML with clear syntax errors. Comments, CDATA, and attributes are preserved. Runs locally in your browser.

Runs in your browserFree · No sign-up

About XML Formatter & Validator

The XML formatter checks that a document is well-formed and re-indents it, or minifies it by removing extra whitespace between elements. Comments, CDATA, processing instructions, and attribute quotes are kept. DOCTYPE declarations are rejected so external entities are never processed.

How to use XML Formatter & Validator

  1. Paste XML into the input panel, or open a .xml file.
  2. Select Format to pretty-print or Minify to compact the document.
  3. If the XML is invalid, the error shows the line and column.
  4. Copy or download the result.

Examples

Nested elements

<root><item>1</item></root> becomes a two-level indented document.

Mixed content

<p>Hello <em>world</em>!</p> stays on one line so the wording is not broken up.

Limitations

  • This tool checks well-formedness, not validity against an XSD or DTD.
  • DOCTYPE declarations are not processed and are rejected.
  • XML names are accepted using a practical ASCII-oriented name rule; unusual Unicode names may be reported as invalid.

Privacy

This tool processes everything locally in your browser tab. Your input is not uploaded to Utilhex or any third party, and it is discarded when you close or reload the page. Read the privacy policy for details.

Frequently asked questions

Is my input sent anywhere?

No. Processing happens in your browser. Utilhex does not send tool input to its servers, analytics, or any AI service.

Will formatting change my data?

Whitespace-only text between elements is normalized. Text inside an element, attributes, comments, and CDATA are left as they are.

Why was my DOCTYPE rejected?

DTDs can pull in external entities. Utilhex does not process them, so the declaration must be removed first.