Sign up free

Online XML Formatter and Beautifier

Paste XML to check that it's well-formed, then pretty-print it or minify it.

About XML Formatter

An XML formatter helps whenever XML arrives as one long line: a sitemap you're about to submit to Google Search Console or Bing, an RSS feed that won't validate, an SVG exported from a design app, or a config file such as a pom.xml or an Android layout. Paste the XML or open a file, and it's checked and formatted as you type.

The check uses your browser's built-in XML parser. If the document isn't well-formed, you see the error with its line and column, which usually points to an unclosed tag, an unescaped ampersand or a missing quote. Valid XML is indented with 2 spaces, 4 spaces or tabs, keeping comments, CDATA sections and processing instructions, while Minify strips whitespace and comments instead. This is a well-formedness check, not validation against a DTD or XSD schema. For sitemaps, the Sitemap Checker also tests the URLs inside. Nothing is uploaded.

How to use XML Formatter

  1. 1
    Paste your XML

    Paste the XML or open a file such as sitemap.xml or an SVG.

  2. 2
    Fix any error

    If the XML isn't well-formed, go to the line and column the XML formatter shows.

  3. 3
    Pick a layout

    Choose 2 spaces, 4 spaces or tabs, or tick Minify.

  4. 4
    Copy or download

    Copy the result or download it as a file.

Why use Cubfile for this

  • Error line and column

    The browser's XML parser locates syntax errors for you.

  • Nothing dropped

    Comments, CDATA sections and processing instructions stay in the formatted output.

  • Pretty-print or minify

    Indent with 2 or 4 spaces or tabs, or tick Minify to strip whitespace and comments.

  • Any XML

    SVG files, RSS feeds, sitemaps and config files all work.

FAQ

XML Formatter: questions and answers

How do I validate XML online?
Paste it or open the file. If it isn't well-formed, you get the error message with its line and column. If it is, you see the formatted XML. Ordinary HTML pages usually fail this check, so format those with the HTML Formatter.
Does the XML formatter validate against an XSD or DTD?
No. It checks that the XML is well-formed, meaning tags are closed and properly nested and attributes are quoted, using your browser's XML parser. Schema validation isn't included.
Are comments and CDATA kept?
Yes. Comments, CDATA sections and processing instructions are kept when the XML is pretty-printed. Minify drops the comments but keeps CDATA.
Can I format an SVG or a sitemap?
Yes, any XML works, including SVG files, RSS feeds, sitemaps and config files. To check the URLs listed in a sitemap, use the Sitemap Checker.
Is my XML uploaded when I format XML online?
No. Parsing and formatting happen in your browser, so nothing is sent to our server, and there's no daily limit.
Share XML Formatter with a friendIt runs in any browser, and they can try it without signing up.

Related tools

HTML HTML FormatterIndent messy HTML so it’s easy to read.
JS JavaScript FormatterBeautify minified or messy JavaScript.
HEX Color ConverterConvert colors between HEX, RGB, HSL and CMYK, and check contrast.
CRON Cron Expression GeneratorBuild cron expressions and see the next run times in plain words.
CSS CSS FormatterTurn minified CSS into neat, readable rules.
CSS CSS MinifierMinify CSS to load faster.
HTML HTML MinifierShrink HTML by removing comments and extra whitespace.
HTTP HTTP Request TesterSend GET, POST and other requests to a public API and read the response.