Skip to content

XML Formatter

Developer Tools•Client-Side & Private

Pretty-print or minify XML, check well-formedness with line and column errors, and explore a tree view — CDATA and namespaces handled in your browser.

Tool workspace
Pretty-printed XML · well-formed ✓
<?xml version="1.0" encoding="UTF-8"?>
<catalog xmlns:bk="https://example.com/books">
  <bk:book id="bk101">
    <title>XML Guide</title>
    <price>44.95</price>
    <![CDATA[Special <offer> & more]]>
  </bk:book>
  <bk:book id="bk102">
    <title>JSON Handbook</title>
    <price>29.99</price>
  </bk:book>
</catalog>

This checks well-formedness (matching tags, one root, quoted attributes) — it does not validate against a schema or DTD. CDATA sections and namespaces are preserved as parsed by the browser.

Loading tool controls…

Files processed locally — never uploaded to our servers
Free Instant Private

Verify it yourself: press F12, open the Network tab, and use this tool — your files are never uploaded.

XML Formatter at a glance

Price
Free
Account
Not required
File uploads
None — your files are never uploaded

Who uses Developer Tools?

Developers and engineers formatting JSON, testing regex, hashing data, encoding values or building API requests.

How to Use XML Formatter

Follow these simple steps to get instant results in your browser.

1

Paste Your XML

Paste XML into the box — or use the sample, a small book catalog with a namespace and a CDATA section.

2

Pick Pretty or Minify

Choose pretty-print for reading, or minify for the smallest file. Minify can also strip comments.

3

Check and Explore

If the XML is not well-formed, the line and column of the error are shown. If it is, copy the result or open the tree view.

💡

What is XML Formatter & How Does It Work?

XML Formatter pretty-prints or minifies XML and checks that it is well-formed, with the line and column of the first error when it is not. Pretty-printing adds indentation and line breaks so the structure is readable; minifying strips the whitespace between tags (and optionally comments) to make the file as small as possible. Neither changes the data — only the whitespace.

Well-formedness is checked by the browser's native DOMParser — the same parser every browser uses — so CDATA sections and namespaces are handled exactly as the browser parses them. A namespaced element such as <bk:book> formats and appears in the tree view with its prefix, and a CDATA section such as <![CDATA[Special <offer> & more]]> is kept as-is.

The tree view turns the document into a collapsible outline: each element shows its attributes and text, so you can explore a large document without scrolling through raw markup. This checks well-formedness only — matching tags, one root, quoted attributes — not validation against an XSD schema or DTD, and the page says so.

⚡

Key Features & Capabilities

✓

Pretty-Print and Minify

Readable indentation or the smallest possible file, from the same input.

✓

Line and Column Errors

Well-formedness failures are reported with the parser's exact line and column.

✓

Collapsible Tree View

Explore the document as an outline of elements, attributes and text.

✓

CDATA and Namespaces

CDATA sections and namespaced elements are preserved and parsed correctly.

✓

Private by Design

Parsing runs in your browser; your XML is never uploaded.

Pro Tips

  • •Bookmark this tool for instant one-click access anytime.
  • •Drag and drop files directly onto the input surface for fastest handling.
  • •All processing happens in your browser session for maximum speed and data safety.

🎯 Common Use Cases

Reading API ResponsesPretty-print an XML response from an API or RSS feed so its structure is visible at a glance.
Fixing a Broken FeedFind the line and column of a mismatched tag in an RSS or sitemap file instead of hunting by eye.
Shrinking Config FilesMinify an XML config or data file before storing or sending it, without changing its meaning.
Debugging an RSS FeedPaste a feed that will not load, read the exact line and column of the error, fix the mismatched tag, and re-check it here.
📚

Sources & Further Reading

Frequently Asked Questions about XML Formatter

Frequently asked questions

The XML breaks the basic syntax rules: mismatched tags, more than one root element, or an unquoted attribute, for example. The page shows the line and column from the browser’s XML parser so you can find the fault — for example, a missing </title> is reported on the line where the parser noticed it.

Yes. CDATA sections such as <![CDATA[Special <offer> & more]]> are kept as-is, and namespaced elements like <bk:book> are formatted and shown in the tree view with their prefix. Well-formedness is checked by the browser’s native DOMParser, which understands both.

Pretty-print adds indentation and line breaks so the structure is readable; minify removes the whitespace between tags (and optionally comments) to make the file as small as possible. Neither changes the data — only the whitespace.

No — it checks well-formedness only (matching tags, one root, quoted attributes). It does not validate against an XSD schema or DTD, and the page says so.

Yes. Minify mode has a Remove comments checkbox, switched on by default — comments are stripped and the tags are joined together. Switch it off if you want the comments kept.

A collapsible outline of your document — elements, attributes and text — with the top two levels open to start. It only appears when the XML is well-formed, and it is handy for exploring a large API response without scrolling through raw text.

Complementary utilities for your workflow

View all →
You are here

XML Formatter

Pretty-print, minify and validate XML, with a tree view.

Current tool
Popular

JSON Formatter

Format, beautify, and syntax-highlight JSON data.

Try tool

XML to JSON

Convert XML data structures to JSON formats.

Try tool

JSON to XML

Convert JSON structures to XML format.

Try tool

JWT Encoder

Sign JWTs with HS256/384/512 — header, claims, secret in.

Try tool