DataFmt

XML Formatter / Minifier

Format XML for readability or minify it for transport — switch modes with one click.

Drag & drop a file here, or click to upload
Options:

About this tool

XML often ships as a single compact line for efficient transport, yet reads best when indented. This tool toggles between the two representations at will.

Built on fast-xml-parser, it first parses the XML into an object model and then serialises it in the chosen mode, preserving attributes, CDATA sections and namespaces.

How to use

  1. Paste XML or upload an .xml file.
  2. Pick "Beautify" or "Minify".
  3. Choose indent width (2 spaces, 4 spaces or Tab).
  4. Click "Format".

Use cases

Notes

Frequently Asked Questions

Does beautification change the semantics?
No. Only whitespace is altered; structure, attributes and text remain identical.
Are XML declaration and DOCTYPE preserved?
The XML declaration is re-emitted. DOCTYPE is not rewritten in this release; keep it manually if needed.
Does it support namespaced XML?
Yes. Namespace prefixes are retained in the output.