sitekits.dev
press ⌘K to switch tools
FORMAT & CONVERT

XML Formatter

Format XML documents for readability.

local
xml-format
§01 ABOUT THIS TOOL

Overview

This tool re-indents XML so nested structure becomes readable. It collapses whitespace between tags, then places each element on its own line with two-space indentation per depth level. XML declarations (<?xml ?>), comments/doctypes (<!... >), and self-closing tags (<br/>) are handled; short text content stays inline with its element. Useful for inspecting minified SOAP responses, sitemaps, RSS feeds, or pom.xml-style configs.

How to use

  1. Paste your XML into the XML field — a single-line document is fine.
  2. The re-indented result appears in Formatted immediately as you type.
  3. Copy the output from the read-only field.

Examples

  • <root><item id='1'>a</item></root>

    <root>
      <item id='1'>a</item>
    </root>
    

Notes

The formatter is structure-based, not a full XML parser: it does not resolve entities, namespaces, or CDATA semantics, and it does not verify that tags balance. Significant whitespace inside mixed content may be normalized, so avoid formatting documents where inner whitespace is meaningful (e.g. certain xml:space="preserve" sections).

FAQ
Is my XML uploaded to a server?
No. Formatting runs entirely in your browser with a lightweight JavaScript tokenizer. Nothing is transmitted, so proprietary configs and API payloads stay on your machine.
Does the tool validate my XML?
No. It is a formatter, not a validating parser. It re-indents based on tag structure and will still produce output for malformed XML — mismatched tags simply lead to odd indentation rather than an error. Use a dedicated validator to check well-formedness.
Can I change the indentation size?
Not currently. Output uses a fixed two-space indent per nesting level, which is the most common convention for XML in version control.