XML Formatter
Pretty-print or minify XML and check that it is well-formed.
This tool needs JavaScript enabled to run in your browser.
What this tool does
This tool pretty-prints XML with consistent indentation, or minifies it to a single line, and tells you whether the document is well-formed. Paste XML, or import a .xml file, and the result updates as you type.
How it stays safe
Well-formedness is checked by parsing the XML into an inert document in your browser. It does not resolve DTDs or external entities and never makes a network request, so a document with an external entity reference cannot reach out anywhere. The formatting itself works on the tag structure, so it handles large documents without building a full model.
Formatting notes
- Elements that contain only text stay on one line, such as
<title>value</title>. - Elements with child elements are expanded, one per line, indented by depth.
- Minify removes the whitespace between tags but leaves text content untouched.
Common use cases
- Making a dense XML response or config readable.
- Checking whether an XML document is well-formed.
- Minifying XML before embedding it somewhere.
Frequently asked questions
- Does it process external entities?
- No. The well-formedness check uses an inert parser that does not resolve DTDs or external entities and never makes a network request, so there is no XXE risk.
- Can it validate against a schema?
- It checks well-formedness, not validity against an XSD or DTD. Those need the schema itself, which this tool does not fetch.
Learning resources
Testsmith also runs hands-on courses and a free practice app for the skills behind this tool.