๐Ÿงน XML Formatter

Indents an XML string to match its tag structure.

How to use

  1. Enter your XML string.
  2. Click "Format".
  3. You'll see the result indented to match its tag structure.

๐ŸŽฏ Use Cases

Example

Input
<config><host>localhost</host><debug enabled="true"/></config>
Output
<config>
  <host>
    localhost
  </host>
  <debug enabled="true"/>
</config>

A one-line minified XML string is indented by two spaces per level to match its tag hierarchy. Text inside an element moves to its own line, and empty (self-closing) tags are kept exactly as written.

FAQ

Are CDATA sections handled correctly?
Yes. CDATA sections are preserved exactly as-is, so their inner content is never restructured.
Can it format invalid (non-well-formed) XML too?
XML that isn't well-formed, such as mismatched tags, may be indented differently than expected. Check the original structure first.
Is the content I enter sent to a server?
No. It's processed entirely in your browser.

More Coding Tools

๐Ÿ“˜
JSON Formatter
Prettify, validate & minify JSON
๐Ÿ—“๏ธ
Timestamp Converter
Convert Unix timestamp โ†” date
๐Ÿงฉ
JSON String Encoder
Convert text โ†” JSON string literal
โœจ
JS/CSS Formatter
Indent & tidy JS/CSS code
โœ‚๏ธ
JS/CSS Minifier
Strip comments & whitespace
๐Ÿงฝ
HTML Formatter
Indent HTML by tag structure
๐Ÿ—ƒ๏ธ
SQL Formatter
Break SQL into clauses & indent
๐Ÿ”ฃ
HTML Entity Encoder
Convert special chars โ†” HTML entities
๐Ÿ“Š
Excel to HTML Table
Convert spreadsheet data to HTML TABLE
โ›“๏ธ
Link Extractor
Extract href/src links from HTML
๐ŸŽจ
Color Picker
Get HEX, RGB & HSL color codes
๐Ÿ˜
PHP Syntax Checker
Check bracket/string pairing (practical checker)
๐Ÿ—„๏ธ
MySQL Syntax Checker
Check bracket/quote pairing (practical checker)
๐Ÿ”
HTML5 Validator
Check tag pairing, duplicate id, missing alt
โœ๏ธ
Online HTML Editor
Write & edit HTML visually