Small tools. Better flow.

XML formatter & minifier

Validate XML, format it, or remove formatting whitespace.

Usage guide

Your input stays in this browser.

Input & options

Text 1 MB

View code examples ↓

Result

Your result will appear here.

Code examples

Starting points for your own code. Run them in the environment shown below.

Browser · DevTools console

Current inputs apply only to fields used by the example. Selected files are not embedded.

const input = '<root><user name="Alice">Hello</user></root>';
const document = new DOMParser().parseFromString(input, "application/xml");
if (document.querySelector("parsererror")) throw new Error("Invalid XML");
console.log(new XMLSerializer().serializeToString(document));
// Do not remove text-node whitespace blindly: mixed content can change.

Put it to work

Validate XML, format it, or remove formatting whitespace.

Details that matter

Format and meaning

Preserves mixed content and xml:space="preserve". DTDs and external entities are unsupported.

Supported scope and limits

Text 1 MB

Split inputs that exceed the limit. If a format or algorithm is unsupported, choose a tool that matches your requirements instead of silently changing the format.