XML Formatter
Format and indent XML documents. Preserves self-closing tags and namespaces.
FormatValidateClient-sideUnlimited
Indent
0 / 500,000
How to use
- Paste your XML. Any XML document works.
- Copy the formatted output. Pretty-printed with 2-space indent.
Common use cases
- Reading SOAP and RSS feeds
- Auditing Android and iOS resource files
- Inspecting SVG source
- Reviewing XML config files (Spring, Maven, .NET app.config)
Frequently asked questions
- Does this formatter validate the XML too?
- It will reject input that fails to parse and surface the error, but it does not validate against a DTD or XML Schema (XSD). For schema validation, use a dedicated XSD or RelaxNG validator.
- Are XML namespaces and self-closing tags preserved?
- Yes. Namespaces (xmlns) and namespace prefixes round-trip unchanged, and self-closing tags like <br/> stay self-closing in the output.
- What indent levels are supported?
- You can pick 2 spaces, 4 spaces, or tab indentation to match your editor settings or coding standards.
- Will CDATA sections, comments, and processing instructions be preserved?
- Yes. <![CDATA[…]]> sections, <!-- comments -->, and <?xml ?> processing instructions all carry through to the formatted output intact.
- Can I convert formatted XML into JSON?
- Yes. Use the Convert to JSON button on the output panel to turn the parsed XML tree into a JSON structure suitable for APIs or document stores.
- Does this tool send my XML to a server?
- No. Parsing and formatting run in your browser via fast-xml-parser, so sensitive XML never leaves your device.
Related tools
How to use
- Paste your XML. Any XML document works.
- Copy the formatted output. Pretty-printed with 2-space indent.
Common use cases
- Reading SOAP and RSS feeds
- Auditing Android and iOS resource files
- Inspecting SVG source
- Reviewing XML config files (Spring, Maven, .NET app.config)
Frequently asked questions
- Does this formatter validate the XML too?
- It will reject input that fails to parse and surface the error, but it does not validate against a DTD or XML Schema (XSD). For schema validation, use a dedicated XSD or RelaxNG validator.
- Are XML namespaces and self-closing tags preserved?
- Yes. Namespaces (xmlns) and namespace prefixes round-trip unchanged, and self-closing tags like <br/> stay self-closing in the output.
- What indent levels are supported?
- You can pick 2 spaces, 4 spaces, or tab indentation to match your editor settings or coding standards.
- Will CDATA sections, comments, and processing instructions be preserved?
- Yes. <![CDATA[…]]> sections, <!-- comments -->, and <?xml ?> processing instructions all carry through to the formatted output intact.
- Can I convert formatted XML into JSON?
- Yes. Use the Convert to JSON button on the output panel to turn the parsed XML tree into a JSON structure suitable for APIs or document stores.
- Does this tool send my XML to a server?
- No. Parsing and formatting run in your browser via fast-xml-parser, so sensitive XML never leaves your device.