Home › Developer Tools › XML Formatter
</>

Free Online XML Formatter & Validator

Pretty print, validate or minify XML — sitemaps, feeds, SOAP messages and config files.

Your data stays on your device. This tool processes everything directly in your browser. Nothing you enter is sent to our servers.

Tip: Ctrl + Enter to format · Ctrl + K to clear

Output
Formatted XML will appear here.

How it works

  1. Paste your XML — a sitemap, RSS feed, SOAP response or config file.
  2. Choose 2 spaces, 4 spaces or tabs for indentation.
  3. Click Format, Validate or Minify.
  4. If there is an error, the message shows the line number to fix. Copy or download the result.

Frequently asked questions

What makes XML "well-formed"?

Every opening tag needs a matching closing tag (or must self-close like <br/>), tags must nest properly, attribute values need quotes, and the document must have exactly one root element.

What are the most common XML errors?

Mismatched or unclosed tags, a stray & that should be written as &amp;, unquoted attributes, and two root elements pasted one after another. The validator points to the line where the problem starts.

Does formatting change my data?

Formatting only changes whitespace between tags. Comments, CDATA sections and attribute values are kept exactly as written.

Is my XML sent to a server?

No. Formatting and validation run in your browser, so API responses and configuration files stay private.

Make XML readable in seconds

XML from APIs, exports and sitemaps often arrives as a single long line. This formatter indents every element so the structure is clear, keeps short elements on one line, and leaves comments, CDATA sections and attribute values untouched.

Validate before you ship

Invalid XML breaks feeds, integrations and configuration loading. The validator checks that tags are properly nested and closed, that there is a single root element, and — using your browser's XML parser — that the document is well-formed. Errors include the line number so you can jump straight to the problem.

Minify XML

Minifying removes whitespace between tags and comments, producing the smallest document for transfer or storage. Text inside elements is kept, with runs of spaces collapsed.

Common uses

  • Reading SOAP and REST API responses
  • Checking XML sitemaps and RSS or Atom feeds
  • Tidying Android layouts, Maven POM files and .NET config files
  • Inspecting SVG markup

Keyboard shortcuts

/
Search all tools
?
Show this help
Esc
Close search or dialogs
Ctrl + Enter
Run the tool's main action (Format, Generate, Calculate…)
Ctrl + K
Clear the tool's input

Tool shortcuts work while you're using a tool, including inside its text boxes.