Tools

Home
JSON FormatterSQL FormatterJS ValidatorMinify CSS
Merge PDFCompress PDFImage to PDF
JPG to PNGPNG to WebPCrop Image

Prettify XML

Format and indent XML with customizable indentation. Makes XML readable and well-structured. 100% client-side.

Your files never leave your browser
XML Input0 chars, 0 lines
Prettified Output0 chars, 0 lines
Error:
    Ready·

    Paste minified or badly indented XML and get it back with clean, consistent formatting — 2 spaces, 4 spaces, or tabs. Syntax errors show up right away, so you catch broken tags before anything else touches the file. And everything runs in your browser. Nothing gets uploaded.

    How It Works

    Paste Raw XML
    →
    Parse & Indent
    →
    Formatted Output

    The browser's built-in DOMParser reads your XML and builds a tree of every element, attribute, and text node. Then a recursive formatter walks the tree, adding your chosen indentation at each depth level. CDATA blocks and comments stay untouched — only whitespace changes.

    Examples

    Minified API response

    A SOAP service returned everything on a single line. You need to read the actual data.

    INPUT
    <users><user id="1"><name>Alice</name><role>admin</role></user><user id="2"><name>Bob</name><role>editor</role></user></users>
    OUTPUT
    <users> <user id="1"> <name>Alice</name> <role>admin</role> </user> <user id="2"> <name>Bob</name> <role>editor</role> </user> </users>

    Maven pom.xml with inconsistent spacing

    Half the file uses tabs, the other half uses 3 spaces. The prettifier normalizes it all to your preferred indent style.

    INPUT
    <project> <groupId>com.app</groupId> <artifactId>core</artifactId> <version>2.1.0</version> </project>
    OUTPUT
    <project> <groupId>com.app</groupId> <artifactId>core</artifactId> <version>2.1.0</version> </project>

    Nested SVG markup

    Exported SVG from a design tool — deeply nested groups and paths all jammed together.

    INPUT
    <svg><g id="layer1"><rect width="100" height="50"/><circle cx="25" cy="25" r="10"/></g></svg>
    OUTPUT
    <svg> <g id="layer1"> <rect width="100" height="50"/> <circle cx="25" cy="25" r="10"/> </g> </svg>

    Who Uses This

    👨‍💻 Backend Developers

    Debugging SOAP responses and XML-based API payloads that arrive as a single wall of text.

    ⚙️ DevOps Engineers

    Cleaning up Maven pom.xml files, Tomcat configs, or CI pipeline definitions before committing.

    🎨 Designers

    Reading exported SVG code to hand-edit paths, colors, or viewBox dimensions.

    📊 Data Analysts

    Making sense of XML data feeds from government or financial APIs before converting to CSV.

    Common Mistakes

    Pasting HTML instead of XML

    HTML has self-closing tags like <br> and <img> that aren’t valid XML. The parser will throw an error. If you’re working with HTML, use the HTML Beautifier instead.

    Missing the XML declaration

    Not an error here, but some systems need <?xml version="1.0"?> at the top. The tool preserves it if it’s there — it won’t add one automatically.

    Unescaped ampersands in text content

    A bare & in XML is illegal. You’ll see a parse error if your data has something like AT&T instead of AT&amp;T. Fix the source data first, then prettify.

    Technical Details

    Frequently Asked Questions

    What does XML prettifying actually do?

    It takes minified or badly indented XML and reformats it with consistent line breaks and indentation. Each nested element gets indented one level deeper than its parent. The data itself doesn’t change — only the whitespace around tags.

    Will this tool fix broken XML?

    No. It catches errors and tells you where they are, but it won’t auto-repair missing closing tags or unescaped characters. You’ll need to fix those yourself, then run the prettifier again. Think of it as a formatter, not a fixer.

    Is there a file size limit?

    There’s no hard limit — it depends on your browser and how much memory your device has. Files under 10 MB format almost instantly. Larger files work too, but they might take a few seconds.

    Does it keep my CDATA and comments?

    Yes. CDATA sections pass through untouched because their content is meant to be raw text. Comments get preserved and indented to match the nesting level where they appear.

    Is my XML data safe? Does it get uploaded?

    Your data stays on your device. The formatting runs entirely in JavaScript inside your browser — nothing gets sent to any server. Close the tab and it’s gone.

    Share: