XML Formatter
Pretty-print XML with clean, consistent indentation. Self-closing tags and declarations are preserved, and simple text-only elements stay on one line. Instant and in-browser.
Readable, indented XML
The formatter re-indents your XML based on how the tags nest, placing each element on its own line so the
document structure is clear at a glance. Elements that wrap a single text value (like
<title>toolcan</title>) stay on one line, while the XML declaration and
self-closing tags such as <item/> are preserved exactly.
Formatting happens in your browser, nothing is uploaded.
What this does
An XML formatter re-indents XML based on tag nesting, putting each element on its own line so the structure is clear.
How to use it
- Paste your XML.
- Format it.
- Read the indented output.
- Copy the result.
How it works
Each element is placed on its own line and indented by its depth, while the XML declaration and self-closing tags are preserved exactly. Simple text-only elements stay on one line.
Example
A flat <root><item>1</item></root> becomes a nested, indented tree.
Sources & methodology
Last updated .
Frequently asked questions
What does the formatter do?
It re-indents your XML based on tag nesting, putting each element on its own line so the structure is clear. Elements that wrap a single text value are kept on one line.
Are declarations and self-closing tags kept?
Yes. The XML declaration (<?xml …?>) and self-closing tags such as <item/> are preserved exactly.
Is my XML private?
Yes. Formatting happens locally in your browser; nothing is uploaded.
Related tools
JSON Formatter
Pretty-print, validate and minify JSON, with selectable indentation and optional recursive key sorting. Syntax errors are pinpointed by line and column. Fast and private, all in your browser.
SQL Formatter
Format SQL queries for readability: keywords are uppercased and major clauses like FROM, WHERE, JOIN and ORDER BY start on new lines. String literals are left untouched. Runs in your browser.
Code Minifier
Minify JavaScript or CSS by stripping comments and unnecessary whitespace, safely preserving strings, template literals and regex. See the size saved instantly, all in your browser.
Base64 Encoder & Decoder
Encode text to Base64 or decode Base64 back to text, with a URL-safe (base64url) option. UTF-8 aware, so emoji and accented characters round-trip perfectly. Runs in your browser.