Skip to main content
PixelTools

XML formatter & validator

Format, validate, and minify XML. Free, private — nothing leaves your browser.

0 characters
Beautified XML0 characters
Your beautified code will appear here.

Everything you need to work with XML

Format and check in one step

Well-formed XML is indented. Broken XML shows what went wrong, with line and column.

Your choice of indent

2 spaces, 4 spaces, or tabs, or minify to the smallest possible size.

Instant, live output

The result updates as you type or paste. No button to click and no page reload.

CDATA, comments and namespaces kept

Declarations, DOCTYPE, CDATA, comments and prefixes are copied through exactly as written.

Copy or download

Copy the result to your clipboard or save it as an .xml file.

100% private

Your XML never leaves your browser. Nothing is uploaded, logged, or stored.

Format XML in three steps

  1. 1

    Paste your XML

    Paste or type XML into the input box. It can be one long line, a sitemap, an RSS feed or a half-indented config file.

  2. 2

    Check the result

    Well-formed XML appears indented straight away. If a tag is unclosed or an attribute is missing its quotes, you get an error with the line and column of the first problem.

  3. 3

    Pick an indent, then copy or download

    Choose 2 spaces, 4 spaces, or a tab, or switch to Minify for the smallest size. Copy the result or download it as an .xml file.

Built for everyday developer work

XML from an API, a sitemap or a config file often arrives as one long line, and one unclosed tag breaks it. Formatting makes it readable, and validating tells you exactly where it is wrong.

Reading an API or SOAP response

Paste a one-line XML response and see its structure laid out.

Debugging a config file

Find the unclosed tag or unquoted attribute in a pom.xml, web.config or Android manifest.

Checking a sitemap or RSS feed

Make sure a sitemap.xml or feed is well-formed before you submit it.

Sharing readable XML

Indent a payload before pasting it into a ticket, a doc, or a chat message.

Frequently asked questions

What does an XML formatter do?

+

It re-writes XML with line breaks and indentation so a person can read it. The tags, attributes and text stay the same. Only the whitespace between elements changes.

Does this also validate my XML?

+

It checks that the XML is well-formed: every tag is closed and matches, attributes are quoted and not repeated, there is exactly one root element, and & is escaped. It does not check the document against a schema (XSD) or DTD.

Why does it say my XML is invalid?

+

The usual causes are a tag that is never closed, a closing tag with the wrong name, an attribute value without quotes, a bare & in text (write &), or two root elements. The error names the problem and the line and column where it was found.

Are CDATA, comments and namespaces kept?

+

Yes. CDATA sections, comments, processing instructions such as the <?xml ?> declaration, the DOCTYPE, namespace prefixes and attributes are copied through exactly as you wrote them.

Will formatting change my text content?

+

Text is never rewritten. Spaces and line breaks around an element's text are trimmed when it is indented, and text mixed in between child elements is moved onto its own line, so check output carefully if whitespace inside mixed content matters to you.

How do I minify XML instead?

+

Switch the toggle from Beautify to Minify. It removes the whitespace between tags and keeps your text, CDATA and comments, which shrinks sitemaps, feeds and payloads.

Is my XML uploaded anywhere?

+

No. Formatting runs entirely in your browser with JavaScript. Nothing you paste is sent to a server, logged, or stored, so it is safe to use on config files and API responses that contain private data.

Format your XML now

Free, no account needed.