XML Formatter
Beautify and indent XML while keeping comments, CDATA sections, attributes and element order exactly as written.
Runs in your browserXML → XML
Loading tool…
Example
<note><to>Ada</to><!-- greeting --><body lang="en">Hello</body></note>
<note> <to>Ada</to> <!-- greeting --> <body lang="en">Hello</body> </note>
How to use the XML Formatter
- Paste or type your XML into the input area, or open a file from your device.
- Adjust the options above the editor if the tool offers any.
- Review the XML result, then copy it or download it as a file.
Privacy and limitations
- Your data is processed on your device and is not uploaded to any server.
- Whitespace-sensitive content (xml:space="preserve") is re-indented like any other content.
Frequently asked questions
Will formatting change my XML data?
Only whitespace between elements changes. Comments, CDATA, attributes and element order are kept. Leading and trailing spaces inside text-only elements are trimmed.
Related converters
XML ValidatorCheck that XML is well-formed: matching tags, quoted attributes and a single root, with line numbers.XML ViewerBrowse XML as an expandable tree of elements, attributes and text, with search and XPath of the selected node.XML to JSON ConverterConvert XML to JSON. Attributes become @_name keys, repeated elements become arrays, numbers are detected.XML MinifierMinify XML by removing whitespace between tags and, optionally, comments, to shrink file size.XML to YAML ConverterConvert XML documents to readable YAML, keeping attributes as @_name keys and repeated elements as lists.XML to CSV ConverterConvert repeated XML records into CSV rows. Child elements and attributes become columns.XML to HTML TableTurn repeated XML elements into an HTML table with a header row, with a safe live preview.XPath TesterRun XPath 1.0 expressions against an XML document and see the matching elements, attributes or values.