Developer Tools · Free browser tool

XML Formatter

Format or minify XML with 2-space, 4-space, or tab indentation. DOCTYPE is rejected to prevent entity risks; mixed text and preserved spaces stay intact.

Structure XML with confidence

Beautify or compact well-formed XML with controlled indentation. DTD declarations are rejected to avoid external-entity risks.

Local processing
XML output0 characters
Your formatted XML appears here…

XML is parsed locally. External DTDs and entity declarations are blocked; mixed text content and xml:space="preserve" sections are kept intact.

Processed on your device. Tool inputs are not uploaded or saved by QUICKKIT.

SPECIFICATIONS & EXAMPLES

XML Formatter: safety rules, limits, and whitespace

Formatting parses with @xmldom/xmldom and re-serializes with your indent. Minification removes only layout whitespace between element-only children; mixed text and xml:space="preserve" sections are retained.

XML Formatter specifications

  • Input limits: Up to 1,000,000 characters and 1,000,000 file bytes, 50,000 nodes, and 128 levels of depth.
  • DOCTYPE protection: Any <!DOCTYPE declaration is rejected, which blocks external entity access and entity-expansion (XXE) attacks. Built-in XML entities and normal namespaces are supported.
  • Indent styles: 2 spaces, 4 spaces, or a tab.
  • Whitespace rules: Mixed text content and xml:space="preserve" sections survive minification; only layout whitespace between element-only children is removed.
  • Size stats: Real UTF-8 byte comparison between input and output.
  • Processing: Parsing and formatting happen in the browser; no source is uploaded.

XML Formatter examples

  • Compact note: <?xml version="1.0"?><note><to>Riya</to><body>Ship v2</body></note> → <?xml version="1.0"?> <note> <to>Riya</to> <body>Ship v2</body> </note>
  • Entity risk: An XML file containing a <!DOCTYPE declaration → Rejected with an explanation, because DTDs can enable entity-expansion attacks
  • Preserved text: An element with xml:space="preserve" and significant spaces → The significant spaces kept intact while surrounding layout whitespace is minified

XML is parsed locally in the browser. Nothing is uploaded or saved by QUICKKIT.

A quick walkthrough

How to format or minify XML safely

  1. Paste XML, load the sample or open a local .xml file.
  2. Choose Format XML for readable indentation or Minify XML to remove layout whitespace safely.
  3. Review the syntax-highlighted result and size comparison, then copy or download the XML.
  4. If the result is for an XML consumer that depends on whitespace, keep significant text inside mixed-content elements and use xml:space="preserve" where needed.
Good to know

XML formatter questions, answered

Why are DTD declarations rejected?

Rejecting DOCTYPE avoids external entity access and entity-expansion attacks. Built-in XML entities and normal namespaces are supported.

Does minification remove text content?

No. Mixed text content and xml:space="preserve" sections are retained. Only layout whitespace between element-only children is removed.

Is XML processed locally?

Yes. XML parsing and formatting happen in the browser and no source is uploaded.

Are namespaces removed or renamed?

No. The parser and serializer preserve namespace declarations and qualified element names; the formatter changes layout whitespace, not namespace intent.

COMPARISON

XML Formatter: how it compares, and when to use something else

XML Formatter compared against a cli tool or a hosted playground — what runs locally in this workspace, what rules are enforced, and where another kind of tool is the better fit.

This tool on QUICKKIT compared with A CLI tool or a hosted playground

Verified behaviour of this tool against the alternative approach a searcher is usually weighing it against.
What mattersThis tool on QUICKKITA CLI tool or a hosted playground
Where your data is processedIn this browser tab. Your input is read, processed and exported on your own device, no copy is created on a QUICKKIT server, and closing the page clears it. There is therefore no retained file, no server-side queue and no deletion window to take on trust.Uploaded to the provider's infrastructure, processed there and returned. Retention and deletion are policy statements that cannot be verified from outside, however sincere they are.
Cost, signup and quotasFree in the browser with no account, no trial gate and no watermark; limits come from tab memory and documented scope rather than a paid quota.Often gated behind account registration, usage quotas or paid team seats once you export, save history or run recurring workflows.
XXE protectionAny <!DOCTYPE declaration is rejected, which blocks external entity access and entity-expansion attacks. Built-in XML entities and normal namespaces are supported. Pasting untrusted XML into a formatter that resolves entities is a real attack surface, and this one refuses it.A server-side formatter that resolves entities can be made to read local files or exhaust memory; a browser parser is generally safer but also less capable.
Whitespace correctnessMixed text content and xml:space="preserve" sections survive minification; only layout whitespace between element-only children is removed. A minifier that strips meaningful whitespace corrupts documents, and the distinction is applied deliberately.Naive whitespace stripping is a common cause of subtly broken output.
Limits and reportingUp to 1,000,000 characters and 1,000,000 file bytes, 50,000 nodes and 128 levels of depth, with 2-space, 4-space or tab indentation and a real UTF-8 byte comparison between input and output.DTD validation, schema validation and XSLT transforms need a proper XML toolchain; none is attempted here.

When something else is the better choice

  • This belongs in CI, a git hook, an editor task or a build script. The CLI packages themselves. A browser tab is the wrong place for a pipeline: it cannot see your repository, cannot run unattended, and is bounded by the character and byte caps on this page.
  • You need to work across a project rather than one pasted document — a module graph, a directory of files, or a schema set. The CLI, or a bundler analyser for source maps, tree shaking and bundle size. These tools operate on what you paste and have no view of a project.
  • You need to process more data than the character or byte cap on this page, or at a speed that matters. The equivalent command-line tool. Reading a large input in chunks in a tab works, but it is bounded by browser memory and by the cap stated on the page.

Use XML Formatter on QUICKKIT when you want a fast, browser-based workflow without creating an account or handing inputs to a third-party queue; choose a cli tool or a hosted playground when this belongs in ci, a git hook, an editor task or a build script..