Format XML
Pretty-print, minify, and convert XML to and from JSON right in your browser.
About Format XML.
Format, Minify, and Convert XML in Your Browser
Paste messy, single-line XML and get it back cleanly indented — or collapse a formatted document down to one compact line. The same tool converts XML to JSON and JSON back to XML, so you can move between the two formats without leaving the page. Syntax errors are caught before anything runs, and you get the exact line and column of the problem.
Formatting is faithful: attributes, element order, comments, CDATA sections, and the XML declaration all survive the round-trip, so beautifying a document doesn't quietly reorder or drop parts of it. Choose two-space, four-space, or tab indentation, then copy the result or download it as a file.
Everything happens locally in your browser — no upload, no account, no daily cap. That matters for XML, which so often carries API keys, invoices, configuration, or customer data you shouldn't be pasting into a random website's server.
Common Use Cases
- Debug an API response: Drop in a minified SOAP or REST XML payload and read it as a clean, indented tree.
- Convert to JSON: Turn an XML feed or config into JSON to work with it in JavaScript — attributes come through prefixed with
@_. - Generate XML from JSON: Build well-formed XML from a JSON object for a legacy system or a SOAP request.
- Shrink for transport: Minify an RSS feed, sitemap, or SVG to cut bytes before shipping it.
- Catch a broken document: Find the unclosed tag or stray character by line and column instead of guessing.
- Tidy config files: Re-indent a hand-edited
pom.xml,web.config, or Android layout so diffs stay readable.
An honest note on conversion: XML and JSON don't map perfectly onto each other. When you convert XML to JSON, attributes are prefixed with @_, text content lands under #text, and comments are dropped. When you convert JSON to XML, a top-level array or plain value is wrapped in a <root> element to keep the result well-formed. Formatting and minifying, by contrast, keep the document intact — only whitespace between elements changes.
Privacy: This tool runs entirely in your browser using client-side JavaScript. Your XML and JSON are never uploaded to any server and never leave your device.
How to use Format XML.
Upload your file
Drag and drop or click to select your file.
Choose settings
Adjust quality, size, or format options.
Download result
Your processed file is ready instantly.
Related dev tools.
Privacy-first tools that work everywhere.
Need more than a tool?
Custom websites and web apps that you own — from $799 one-time.
Explore all 188 tools