XML Formatter / Validator

XML Formatter / Validator

Pretty-print, minify, and validate any XML — REST responses, SOAP envelopes, RSS feeds, sitemaps, Maven, AndroidManifest. Syntax-highlighted output, line + column error reports. All in your browser.

Well-formedness is the basic structural rule set: tags must be properly nested and closed, attributes must be quoted, there must be a single root element, special characters must be escaped (<, &, etc.). This tool checks well-formedness using the browser's native DOMParser.

Validity is a stricter check against a schema (DTD, XSD, RelaxNG) — "the document conforms to this grammar". Browser DOMParser doesn't do schema validation; for XSD validation you need a server-side tool like xmllint --schema.

Yes. CDATA sections (<![CDATA[…]]>) keep their contents exactly as written — special characters inside aren't re-escaped. Comments (<!-- … -->) and processing instructions (<?xml-stylesheet … ?>) are placed back in their original positions. The XML declaration and doctype line are preserved as the first lines.

Input
Output

            

Built for real XML, not toy examples

SOAP envelopes, RSS feeds, sitemaps, Maven `pom.xml`, AndroidManifest — handled correctly across format, minify, and validate.

Pretty-print with proper indent

Configurable 2-space, 4-space, or Tab indent. Self-closing tags stay self-closed. CDATA sections, comments, processing instructions, and the XML declaration all survive a format round-trip.

Minify

Strip insignificant whitespace between elements and collapse the whole document to a single line. Useful for embedding XML into a JSON string field or shipping over a tight wire.

Validate with line + column

Well-formedness check using the browser's native DOMParser. On error, the line and column of the bad markup are surfaced inline so you can jump straight to the problem.

Syntax-highlighted output

Tag names, attributes, attribute values, text, comments, CDATA, and processing instructions are all colour-coded so the structure is immediately readable.

Privacy by design

Every byte stays in the browser. Parsing, formatting, validation, and download all run as JavaScript on your machine. Open DevTools → Network and verify zero outbound requests.

Tiny + fast

Pure JavaScript, no framework runtime. Cold load is under 25 KB gzipped. Formatting a 200 KB XML document and re-rendering with syntax highlighting takes under 80 ms.

How to format and validate XML

Four steps from messy XML to clean, validated output.

  1. 1

    Paste your XML

    Drop or paste any XML payload — REST API responses, SOAP envelopes, RSS / Atom feeds, sitemaps, configs. The tool auto-formats as you type (debounced 350ms).

  2. 2

    Pick the indent

    2 spaces is the modern default (matches Prettier and most style guides). 4 spaces is the older convention (Java and.NET). Tab matches your editor's tab width — useful when the document will be hand-edited.

  3. 3

    Validate or minify

    Validate reports any well-formedness errors with line + column. Minify collapses the document to a single line — useful for embedding XML into a JSON string, a database column, or a shell variable.

  4. 4

    Copy or download

    Click the copy icon to send the cleaned XML to your clipboard, or download as formatted.xml. The output preserves CDATA, comments, processing instructions, and the XML declaration.

Built for SOAP, RSS, sitemaps, and config files

Four common XML workflows where a privacy-first browser formatter beats opening an IDE.

SOAP / API debugging

Paste a raw SOAP response from your network log, format it, and the actual fault is now visible inside the envelope. The error line + column lets you jump to a malformed namespace prefix or unescaped & in seconds.

Sitemap & RSS authoring

Paste your hand-written `sitemap.xml` or RSS feed, validate well-formedness before submitting to Search Console / aggregators. Minify to fit in a single line for embedding into automation scripts.

Build files & configs

Maven pom.xml, Spring beans, NHibernate mappings, Android AndroidManifest.xml — all benefit from re-formatting after manual edits. Validate before committing to catch typos that the build would otherwise complain about.

Office docs & EPUB internals

.docx, .xlsx, .pptx, and .epub are all ZIPs of XML. Extract the inner XML, paste here, format, and you can read or edit the structure cleanly before zipping it back up.

100% private — runs in your browser

XML payloads never leave your device. Open DevTools → Network and you'll see zero outbound requests during formatting, validation, copy, or download.

  • Parsing uses the browser's native DOMParser; formatting and minifying are simple JavaScript walks of the resulting DOM tree.
  • No remote validator, no third-party XML API. Every byte of your XML stays on your machine.
  • No login, no telemetry on document contents. We only use one cookie for cookie-consent state and one for language preference.

Related guides

Hand-picked reads on XML, SOAP debugging, and config-file workflows.

Frequently asked

What is well-formedness, and what's the difference vs. "valid" XML?

Well-formedness is the basic structural rule set: tags must be properly nested and closed, attributes must be quoted, there must be a single root element, special characters must be escaped (&lt;, &amp;, etc.). This tool checks well-formedness using the browser's native DOMParser.

Validity is a stricter check against a schema (DTD, XSD, RelaxNG) — "the document conforms to this grammar". Browser DOMParser doesn't do schema validation; for XSD validation you need a server-side tool like xmllint --schema.

Does formatting preserve CDATA, comments, and processing instructions?

Yes. CDATA sections (<![CDATA[…]]>) keep their contents exactly as written — special characters inside aren't re-escaped. Comments (<!-- … -->) and processing instructions (<?xml-stylesheet … ?>) are placed back in their original positions. The XML declaration and doctype line are preserved as the first lines.

Can I paste a SOAP envelope or RSS feed?

Yes, anything well-formed works — SOAP envelopes (with the namespace prefixes soap:Envelope, soap:Body), RSS / Atom feeds, sitemaps, SVG, plist, Maven pom.xml, Spring config, EPUB container.xml, Android AndroidManifest.xml. Namespace prefixes are preserved — we don't strip xmlns: attributes.

Why does my XML say "parser error" when it looks fine?

The most common causes: (1) unescaped & inside text or attribute values — must be &amp;; (2) two root elements (XML allows exactly one); (3) a tag spelled differently from its closing tag (e.g. <Item>…</item> — XML is case-sensitive); (4) attribute value not quoted; (5) an unmatched < in text content. The line + column shown in the error message points to the failing position.

Is anything sent to your server?

No. Parsing, formatting, minifying, validation, syntax highlighting, and the download all run as JavaScript in your browser. Open DevTools → Network and you'll see zero outbound requests during use. We use one cookie for cookie-consent state and one for language preference, that's it.