XML Formatter
Re-indent and line-break minified or messy XML so nested structures become readable. Handy for SOAP envelopes, sitemaps, RSS/Atom feeds, and configuration files.
How to use this tool
- 1
Paste your XML into the text box (one line or many — minified XML works too).
- 2
Read the indented result that appears in the output panel below; it updates automatically as you type, with no button to press.
- 3
Select the formatted text in the output panel and copy it manually into your editor or file.
How does this XML formatter indent your markup?
XML (Extensible Markup Language, a W3C standard) nests elements between matching opening and closing tags, but a minified or single-line document hides that structure. This tool makes the nesting visible by inserting a line break between every adjacent pair of tags (it splits wherever a '>' is immediately followed by a '<') and then indenting each line by two spaces per level of depth. It is a lightweight regex-based reindenter, not a real XML parser: it does not check that your document is well-formed, does not validate against a DTD or XSD, and never reports errors. Depth is tracked by counting opening versus closing tags, with self-closing tags like <br/>, processing instructions like <?xml?>, and comments correctly left at the same level. Inline content such as <name>John</name> stays on one line because the whole line is a single bare element. Because the split keys on the '>' character, a literal '>' inside an attribute value or a multi-line comment can be mis-split and throw off the indentation. For strict validation or schema checks, reach for xmllint or a dedicated XML validator.
Common use cases
Make a one-line SOAP response from a web service readable so you can trace which element holds a fault or value.
Re-indent a minified sitemap.xml or RSS/Atom feed before scanning it for missing or duplicated entries.
Tidy a hand-edited Maven pom.xml, Android layout, or Spring config so the nesting is obvious at a glance.
Pretty-print an XML API payload pulled from logs or a network capture for a quick visual review.
Turn an exported config blob (build files, .csproj, web.xml) into an indented form before diffing it against another version.
Format a snippet for a bug report or documentation so reviewers can follow the element hierarchy.
Frequently asked questions
Does this validate my XML or check that it is well-formed?▼
Can I validate against an XSD or DTD?▼
Can I change the indent size?▼
Is there a Format button, or a way to copy or download the result?▼
Are XML namespaces preserved?▼
Why is some of my XML indented incorrectly?▼
Is my XML uploaded to a server?▼
Related tools
JWT Decoder
Decode JSON Web Tokens (JWT) instantly — inspect the header, payload, and signature claims. Runs entirely in your browser; tokens never leave your device. Safe for production secrets.
JSON Formatter & Validator
Format, validate, and minify JSON instantly. Catches syntax errors with line numbers, pretty-prints with adjustable indent, supports large payloads. Runs in your browser — no upload.
Base64 Encoder & Decoder
Encode and decode Base64 strings.
URL Encoder & Decoder
Encode/decode URL-safe strings.
HTML Entity Encoder & Decoder
Convert special characters to/from HTML entities.
CSS Minifier
Minify CSS to reduce file size.