XML Formatter
Beautify and re-indent XML with consistent spacing, locally in your browser. Paste, format, and copy — nothing is uploaded.
Related
Guides for XML Formatter
Convert JSON to XML: Root Elements, Attributes, and Arrays
XML needs a single root and represents lists as repeated elements. Map @-prefixed keys to attributes and #text to element text for a reversible conversion.
JSON Parse Errors: Read the Message, Jump to the Fix
A directory of JSON parser error messages and the article that explains each one — start with a strict validator, then drill into the specific syntax problem.
Fix Invalid JSON: From 'What's Wrong' to a Clean File
Repair JSON that looks almost right — trailing commas, single quotes, unquoted keys — using a smart formatter that tolerates almost-JSON and then validates strictly.
Online XML Formatter & Beautifier
Paste minified or messy XML and click Format to pretty-print it with clean, consistent indentation. This online XML formatter runs entirely in your browser — your data is never uploaded — so it is safe for API payloads, config, and feeds.
- Beautify XML — turn one-line XML into a readable, indented tree
- Choose indent width — 2 or 4 spaces
- Keeps structure — attributes, comments, CDATA, and the XML declaration are preserved
- Private — an XML beautifier that works locally, with no upload
Format XML with correct indentation
The formatter re-indents elements by nesting depth without touching your data. Comments (<!-- -->), <![CDATA[ ]]> blocks, processing instructions, and attribute values are preserved, so the formatted output is the same document — just easier to read.
Need the data as JSON instead? Use XML to JSON or the JSON ⇄ XML converter. For web markup, see the HTML Formatter.
FAQ
How do I format XML online?
Paste your XML, pick an indent width, and click Format. The tool re-indents every element by depth and you can copy the result — all locally in your browser.
Does formatting change my XML data?
No. It only adjusts whitespace between elements. Attributes, text, comments, and CDATA are preserved, so the document stays equivalent.
Is my XML uploaded anywhere?
No — the XML formatter runs entirely in your browser, so it is safe for confidential or internal data.