Free · No signup · Runs in your browser

XML formatter

Pretty-print nested XML and HTML-like markup, or minify it to a single line. Attributes, comments, CDATA, and the declaration stay intact - all in your browser.

01 · How it works

Three steps, then done.

Paste your markup, pick pretty-print or minify, and copy the result. No upload, no signup, no waiting on a server.

01

Paste your XML

Drop in any XML or HTML-like markup - a config file, an RSS feed, a SOAP envelope, an SVG. The formatter reads tags, attributes, comments, and CDATA as you type.

02

Choose mode and indent

Pick pretty-print to expand nested elements with 2-space, 4-space, or tab indentation, or pick minify to collapse everything onto one compact line.

03

Copy or download

Grab the cleaned-up markup with one click, or download it as a .xml file. Same input always gives the same output - it is fully deterministic.

02 · Why ours

Built for real markup.

A formatter that respects the parts of your document that must not change, and runs entirely on your machine.

  • 01

    Preserves what matters

    The XML declaration, comments, and <![CDATA[...]]> sections are copied through byte-for-byte. The formatter never rewrites the contents your parser depends on.

  • 02

    Pretty or minified

    Expand deeply nested elements for code review, or strip every newline and gap between tags to ship the smallest possible payload. One toggle switches between them.

  • 03

    Indent your way

    Two spaces, four spaces, or a real tab character. Match whatever your editor, linter, or team style guide expects without hand-editing.

  • 04

    Stays on your machine

    Everything runs in JavaScript in your browser. Your markup is never uploaded, logged, or sent to a server - paste sensitive config or API payloads with confidence.

"Comments, CDATA, and the XML declaration are preserved exactly. The formatter only touches the whitespace between your tags."
Why developers trust it with real documents
03 · FAQ

xml formatter questions.

Does this validate my XML?
No - it is a best-effort formatter, not a validating parser. It indents and minifies based on where your tags open and close, so it works on slightly malformed or HTML-like markup too. Use a schema validator if you need to confirm well-formedness.
Yes. Comments (<!-- ... -->), CDATA sections (<![CDATA[ ... ]]>), and the XML declaration (<?xml ... ?>) are copied through exactly as written. Only the whitespace between elements is changed.
Minify removes the whitespace between tags and collapses runs of whitespace in text content, producing a single compact line. It is useful for shrinking payloads before sending them over the wire.
Yes, within reason. Because it is tag-based rather than a strict XML parser, it handles HTML-like markup and self-closing tags well. It does not know HTML's optional closing tags, so deeply nested HTML may indent differently than a dedicated HTML formatter.
No. The tool is 100% client-side - it runs entirely in your browser with no network calls. Nothing you paste leaves your device.