XML Formatter
Indent XML so you can read it, or minify it to a single block. Comments, CDATA and the declaration are kept. The document is not validated against a DTD or schema and is not executed.
XML
Limits
- The input is limited to 2 MB of UTF-8 text (8 MB if you load a file). Larger files can run out of memory in a phone browser tab.
- Not a schema or DTD validator. External entities are not loaded (and should not be).
- HTML-specific quirks (unclosed <li>, implicit <tbody>, void tags without a slash) are treated as errors if they are not well-formed XML.
- Attribute order is kept. Pretty-printing can still change insignificant whitespace in mixed content.
- Documents much larger than the input limit, or with extremely deep nesting, may fail in a small tab.
Formatted XML
How to use XML Formatter
- Paste or load XMLDrop a .xml file or paste the document.
- Choose indent or minifySet the indent size, or switch to minify to remove ignorable whitespace.
- Copy or downloadCopy the result or download a .xml file.
What is rewritten
The formatter tokenizes tags, comments, CDATA, processing instructions and text, then reprints them with consistent indent (or with ignorable whitespace removed). A start tag and its text-only content are kept on one line. Self-closing tags are normalized to a space before the slash.
It is not an HTML parser: it will not fix unquoted attributes the way a browser would, and it will not run scripts or load external entities. DTD and XSD validation are not performed. Mismatched or unclosed tags are reported instead of being guessed.
Frequently asked questions
Is my text or file uploaded?
No. Everything runs in your browser tab with JavaScript. Nothing you type, paste or drop is sent to a server, logged or stored by ALink Tools.
Will this validate my XML?
It only checks that tags nest and close correctly. It will not apply an XSD, a DTD or a Schematron rule, and it will not fetch a SYSTEM identifier.
Can I format HTML here?
Only if the HTML is also well-formed XML (for example XHTML). Use HTML Formatter for typical HTML5.
Are comments and CDATA kept?
Yes. They are not discarded when you pretty-print or minify.
Related tools
All toolsJSON Formatter & Validator
Format, minify, sort keys, and catch syntax errors cleanly.
HTML Encoder / Decoder
Escape and unescape HTML entities without running or rendering the markup.
YAML to JSON
Convert YAML 1.1 to JSON in your browser with js-yaml.
Text Diff Checker
Compare two texts and highlight added, removed and changed lines and words.