Skip to content

XML Formatter & Prettifier Online Free

Last verified May 2026 — runs in your browser
XML Input
Output

Format & Prettify XML Instantly

Paste XML, drop a file, or upload a .xml document and the formatter parses it as a DOM, validates that every tag is well-formed, and re-emits it with consistent indentation using either 2-space or 4-space whitespace. A minify mode strips every non-essential whitespace character so the document collapses to a single line — useful for embedding XML as a payload inside another format or minimising transfer size.

This is the tool for making a SOAP response readable, inspecting a configuration file (pom.xml, web.xml, .csproj), debugging an RSS or Atom feed, cleaning up a sitemap or SVG before committing, reading an Android layout file pasted from a bug report, or preparing an XML fixture for a test suite that expects diffable text. It is also useful for reviewing differences between two XML documents once both are consistently formatted.

Well-formedness is enforced: mismatched tags, unclosed elements, and invalid character entities each surface a specific error message pointing to the line where the parse broke. Attribute quoting is normalised to double quotes, CDATA sections and processing instructions are preserved, and XML comments pass through untouched. Once formatted, the result can be copied or downloaded as a .xml file.

Parsing runs via the browser's native DOMParser — no upload, no server round-trip.

About XML formatting

XML (eXtensible Markup Language) is used for configuration files, data exchange, and web services. Well-formatted XML with proper indentation makes it much easier to read and debug.

  • Format with 2 or 4 spaces indentation
  • Minify to a single compact line
  • Syntax validation with error messages
  • Upload .xml files directly
  • Download formatted results

100% client-side. Your inputs never leave your browser. Ads via AdSense (consent required).

Frequently asked questions

How do I format or minify XML?

Paste XML and the tool parses it, validates well-formedness, and pretty-prints with configurable indent. Attributes stay on their opening tags, self-closing tags are preserved, and CDATA sections are left untouched. A minify mode strips all inter-tag whitespace for network transport. Parse errors are reported with line and column position so you can find an unclosed tag or bad attribute quickly.

Is the XML formatter free?

Yes, fully free with no signup or size cap beyond browser memory. Format or minify as often as you need — useful for SOAP payloads, RSS feeds, SVG files and Android layouts. JSONCraft is free across every tool including this one; no premium gate applies.

Does the XML formatter upload my input?

No. Parsing and formatting run entirely in your browser using the native DOMParser. Nothing is transmitted, which is important because XML payloads often carry SOAP headers with auth tokens or API credentials. You can format production samples safely without leaking anything.

How are CDATA sections and attributes handled?

CDATA content is preserved verbatim — no reformatting, no escaping changes — because changing it would break consumers that treat it as opaque data. Attributes stay on the opening tag in original order by default, with an option to sort alphabetically for diff-friendly output. Entity references (&amp;, &lt;, etc.) are kept as-is, not expanded. Declarations like <?xml version="1.0"?> and DOCTYPE are preserved on the first line.

Does it validate against a schema (XSD/DTD)?

No, the tool validates well-formedness (balanced tags, quoted attributes, valid entities) but not conformance to a schema. That's intentional — most users want quick structural checking, not a full XSD engine in the browser. For schema validation, use a dedicated XML tool or xmllint locally. The formatter is the right choice for indent/minify/lint; schema validation is a different workflow.

Sources (1)
  • Bray, T., Paoli, J., Sperberg-McQueen, C.M., Maler, E., & Yergeau, F. (2008). Extensible Markup Language (XML) 1.0 (Fifth Edition). W3C Recommendation, 26 November 2008.

These are the specifications and standards this tool implements.

By ·