Skip to content

28 tools in stockRuns in your browser

XML Formatter & Validator

Format, minify and check XML for well-formedness, with errors that point to the exact line.

Processed locally

Paste XML and press Format, Minify or Validate. Ctrl + Enter formats.

Instructions

How to use it

  1. 01Paste your XML into the Input box, or load the sample.
  2. 02Press Format to indent it, Minify to remove whitespace between tags, or Validate to check it only.
  3. 03If it isn't well-formed, read the message and press Show me to jump to the line.
  4. 04Copy the output or download it as an .xml file.

About

What it does

XML still powers sitemaps, RSS feeds, SVG graphics, Office documents, SOAP APIs and countless config files. When it arrives as one long line, or a tool rejects it as malformed, you need to see its structure and find the problem quickly.

This formatter checks that your XML is well-formed (tags match, there's one root element, attributes are quoted, ampersands are escaped) and then indents it. Text, attribute values, comments and CDATA sections are kept exactly as written.

Supported formats

XML documents
With or without an <?xml ?> declaration, namespaces and DOCTYPE.
SVG, RSS, Atom, sitemaps
All are XML, so they can be formatted and checked here.

Settings explained

Indent
Choose 2 spaces, 4 spaces or tabs. Elements that only contain text stay on one line, like <name>Ada</name>.
Minify
Removes whitespace between tags only. Whitespace inside text content is meaningful in XML, so it's never touched.

Good for

  • Making a minified sitemap.xml or RSS feed readable
  • Finding the mismatched tag that breaks an import
  • Tidying an SVG before editing it by hand
  • Inspecting SOAP or legacy API responses

Questions, answered

Does this validate against a schema (XSD or DTD)?
No. It checks well-formedness: the syntax rules every XML document must follow. Schema validation (whether the right elements appear in the right places) needs the schema file and is outside the scope of this tool.
Why does it say my '&' is unescaped?
In XML a bare ampersand starts an entity reference. Write &amp; for a literal ampersand, or wrap the text in a CDATA section.
Can it format HTML?
Only if the HTML is also valid XML (XHTML). Regular HTML allows things XML doesn't, such as <br> without a closing slash and attributes without values.
Is my XML uploaded?
No. The parser runs entirely in your browser.