XML Formatter & Viewer
Paste XML and instantly check whether it's well-formed, beautify or minify it, and visualize it as a tree. Nothing is sent to a server — everything runs in your browser.
🔗 Share link encodes the XML you entered directly into the link itself (after the # in the address bar). It's never sent to a server, but anyone with the link can read its contents — don't share sensitive data this way.
How to use
- Input: Paste XML text into the left box, use "Open file" to upload an
.xmlfile, or drag a file onto the page. - Format / Minify / Validate: Use the buttons above to apply indentation, strip insignificant whitespace, or just check well-formedness.
- Check the result: In the right panel, browse tags, attributes, and text with "Tree view" (expand/collapse), or check the formatted source with "Text view". Errors show exactly which line and column caused the problem.
- Convert to JSON: Click the "To JSON" tab to auto-convert the XML structure into a JSON object. Attributes become
@namekeys, text content becomes a plain value or a#textkey, and repeated sibling elements become arrays. - Export: Copy the result to your clipboard or download it as a file (
.xmlor.json).
Everything runs inside your browser (JavaScript) — nothing you enter is sent to a server or stored.
What is XML?
XML (eXtensible Markup Language) is a markup language for representing hierarchical data with tags. Its syntax resembles HTML, but tag names are user-defined, so it shows up in config files, document interchange, protocols like SOAP and RSS, and legacy system integrations. XML has strict "well-formed" rules: every start tag needs a matching end tag (or a self-closing tag), there must be exactly one root element, and special characters like & and < must be escaped as entities. This tool validates your input against those rules.
Frequently Asked Questions
Is my XML data sent anywhere?
No. All parsing and formatting happens in JavaScript inside your browser and is never sent to a server.
Why do I get a "not well-formed" error?
This usually means a start tag and its end tag don't match, there's more than one root element, an attribute value is missing quotes, or the text contains an unescaped & or <. Check the line/column shown in the error message.
Does this validate against a DTD or XSD schema?
No. This tool only validates well-formedness, not conformance to a specific DTD or XSD schema — well-formed XML that's missing schema-required elements won't be flagged.
How are CDATA sections handled?
Content inside <![CDATA[ ... ]]> is preserved verbatim and never parsed as markup. It shows up as its own node in the tree view, and formatting/minifying never touches its content.
Can it handle large XML files?
Files up to a few MB work fine within your browser's memory limits. For very large files, tree-view rendering can get slow — switch to text view instead.
How is XML different from JSON?
JSON's key-value structure is more compact than XML and parses faster, and most languages can handle it without extra libraries. XML can express more complex document structures — attributes, namespaces, XSD schemas, mixed content — but at the cost of size and parsing overhead. Most REST APIs today respond with JSON, though XML is still common in SOAP, RSS, and config files.
What are the rules for converting XML to JSON?
The root element's name becomes the top-level key, each element becomes an object, attributes become @name keys, and text content becomes a plain string value (if there are no child elements) or a #text key. Sibling elements sharing a name are grouped into an array. Comments and processing instructions are dropped from the conversion.