XML Formatter & Minifier

Format and beautify XML or minify it. Adjustable indentation.

About XML Format

Format messy XML into clean, readable structure with proper indentation. Or minify XML to reduce file size. Adjustable indent size for formatting.

XML still runs a huge amount of infrastructure — SOAP APIs, RSS and Atom feeds, SAML assertions, Maven poms, Android layouts, and every Office document under the hood. When you hit an XML payload in a browser or a log, it's often served as a single line with no whitespace, and reading it that way is impractical. A formatter indents each element level, puts attributes on their own lines when the element has many, and collapses empty tags to self-closing form.

The formatter is also useful in the other direction. Minification strips all non-significant whitespace to reduce payload size, which matters for XML over the wire — SOAP requests compressed with gzip benefit further from already-minified source, and RSS feeds served from a CDN should be as small as possible.

Unlike naive regex-based formatters, this one parses the XML first and reports errors with line and column numbers. Unclosed tags, mismatched names, invalid entities, and duplicate attributes are surfaced instead of being silently reshaped into worse output. CDATA sections and processing instructions are preserved verbatim, and attribute order within an element is kept stable so diffs stay clean.

How to use the XML Format
  1. 1

    Paste or upload XML

    Drop minified XML from an API response, an RSS feed, or a SOAP payload. The parser validates structure before anything else.

  2. 2

    Choose format or minify

    Format adds indentation — 2 or 4 spaces, or tabs — and puts each element on its own line. Minify strips all non-significant whitespace for transmission.

  3. 3

    Copy the result

    The output preserves semantics exactly: CDATA, attribute order, namespace prefixes, and self-closing tags are all kept. Parse errors point to the exact line if the input is malformed.

Common use cases

Reading SOAP responses

Format a SOAP envelope to find the Body element and the actual response without counting angle brackets.

Inspecting RSS/Atom feeds

Paste a feed URL's raw response to see items, channels, and their metadata as a readable tree.

Debugging Android layouts

Format a layout XML pulled from a view hierarchy dump to see nesting and attribute assignments clearly.

Minifying feeds for delivery

Strip whitespace from sitemaps or RSS feeds before uploading to shrink bytes served — every kilobyte counts at scale.

Frequently asked questions
Does it validate the XML?

It checks that the document is well-formed — tags balanced, attribute values quoted, entities valid — and reports the first error with line and column. It does not validate against a DTD or XSD schema.

How does it handle CDATA sections?

CDATA content is preserved byte-for-byte. The formatter never indents or modifies text inside a <![CDATA[ ... ]]> block, which matters because whitespace there is significant.

Can it process large files?

Files up to around 20 MB format comfortably in the browser. Larger files are better handled with a streaming parser like xmllint on the command line.

Does it preserve namespaces?

Yes. xmlns declarations and prefixed names are kept exactly as written. Attribute order within an element is stable so diffs against the original remain clean.

What about processing instructions and comments?

Both are preserved. The XML declaration (<?xml version="1.0"?>) stays on the first line, other processing instructions keep their positions, and comments are kept verbatim.

developerformatter