Developer Tools
Prettify XML with two spaces, four spaces or tabs, minify inter-tag whitespace, validate well-formed documents, and preserve comments, namespaces and CDATA without fetching DTDs or external resources.
Simple workflow
How to use XML Formatter & Validator
- 1Paste XML of up to 2 MiB.
- 2Choose indentation, then format, minify or validate.
- 3Copy or download the processed XML locally.
Good to know
Frequently asked questions
Can XML external entities load?
No. DOCTYPE and entity declarations are rejected before parsing, and the tool does not resolve DTDs or remote resources.
What content is preserved?
Well-formed namespaces, comments and CDATA sections are preserved by the bounded formatter. Formatting is intentionally conservative.
Is XML sent to a server?
No. Parsing and formatting remain on this device.
Practical guide
Format XML without resolving external resources
The formatter first checks that XML is well formed, then adds conservative indentation or removes whitespace between tags. Namespaces, comments and CDATA tokens stay present in the processed text.
DOCTYPE and entity declarations are rejected before parsing. This blocks XXE-style external resource resolution and avoids silently expanding content from a file or network location.
Worked example
Format a namespaced document
- Start with
- Paste compact XML containing a namespace, comment and CDATA section.
- Choose
- Choose 2 spaces and Format XML.
- You get
- Readable XML appears locally with those constructs preserved.
Tips for a useful result
- Input is limited to 2 MiB.
- Validation checks well-formed XML, not an XSD schema.
- Review whitespace-sensitive mixed content before replacing a source file.
Keep going