Advertisement

XML formatter

Paste XML to pretty-print it with clean indentation, minify it for production, or validate it for errors.

XML input

Output

Advertisement

Three XML operations

Pretty print re-indents your XML with two spaces per level so nested structures are easy to scan. Minify strips comments and whitespace between tags to shrink payloads for APIs and config files.

Validate checks well-formedness with the browser's own XML parser and reports the first error in plain language, including unclosed tags and bad entities.

What is preserved

CDATA sections, comments (in pretty mode), attributes, and namespaces all survive formatting. Only insignificant whitespace between tags is touched.

If your XML carries an XML declaration, it is kept at the top of the pretty-printed output.

XML Formatter FAQs

What is the difference between valid and well-formed XML?
This tool checks well-formedness: matching tags, proper nesting, quoted attributes. Full validity against a DTD or XSD schema is a separate, stricter check.
Will pretty printing change my data?
No. It only adjusts whitespace between tags. Text content, attributes, and CDATA sections are preserved exactly.
Why did minify barely shrink my file?
If your XML was already compact, there is little whitespace to remove. Minification helps most with hand-written or machine-indented files.
Can I format XML with namespaces?
Yes. Namespace prefixes are kept as-is on tag and attribute names during formatting.
Is my XML sent to a server?
No. Parsing and formatting run entirely in your browser, so private configs and API payloads stay local.
Advertisement