XML Formatter and Validator

Format, beautify, minify and validate XML online with custom indentation — free.

About

About the XML Formatter and Validator

Pretty-prints XML with your choice of indent size, or minifies it down to a single compact line.

Developers working with SOAP APIs, RSS feeds or config files use it to make dense XML readable before debugging it, while anyone handed a minified XML export uses it to check the document is well-formed before importing it elsewhere. It's one of many free data tools on Toolapt, and like every tool here, it's free to use with no sign-up and no limit on how many times you run it.

Choose what to view about this tool

Guide

Using the XML Formatter and Validator

  1. 1

    Step 1

    Paste your XML into the XML box.

  2. 2

    Step 2

    Set the indent size if you want something other than 2 spaces.

  3. 3

    Step 3

    Click "Format" to pretty-print it, or "Minify" to collapse it to one line.

  4. 4

    Step 4

    Click "Copy" to copy the result, or "Clear" to start over.

  • Pretty-prints XML with an adjustable indent size, from 1 to 8 spaces
  • Minifies XML down to a single compact line
  • Validates that the XML is well-formed before formatting or minifying it
  • Clear error message, taken from the parser, when the XML doesn't parse
  • One click to copy the formatted or minified result
  • Works entirely in your browser — nothing you paste is sent to a server
  • Free to use, with no sign-up and no limit on how many times you run it

Developers

Developers working with SOAP APIs or XML config files use the XML Formatter for making a dense response or file readable before debugging it.

Content and feed managers

Content and feed managers use the XML Formatter for checking that an RSS or Atom feed is well-formed and readable.

QA engineers

QA engineers use the XML Formatter for validating that a system's generated XML output is well-formed before it goes further down a pipeline.

Students learning XML

Students learning XML use the XML Formatter for seeing a document's real nested structure laid out with proper indentation.

Examples

XML Formatter and Validator examples

3 worked examples

01

Pretty-printing dense XML

Formatting <root><item>1</item><item>2</item></root> with the default 2-space indent produces a multi-line, nested layout with root and each item tag properly indented.

02

Minifying readable XML

Clicking Minify on a nicely indented multi-line document collapses it back to a single compact line with no whitespace between tags.

03

Catching malformed XML

Pasting <root><item>1</item></root2> triggers a parser error message instead of formatted output, since the closing tag doesn't match the opening one.

FAQ

Frequently asked questions

Quick answers to common questions about the XML Formatter and Validator.

What does the XML Formatter and Validator do?

It pretty-prints or minifies XML, and first checks that the XML is well-formed before doing either.

Is the XML Formatter free to use?

Yes. It's free, with no sign-up, no watermark and no limit on how many times you use it.

Is my XML safe when I use this tool?

Yes. Parsing, formatting and minifying all happen entirely on your own device using the browser's built-in XML parser — nothing you paste is sent to a server.

What happens if my XML isn't well-formed?

The tool reports the parser's error message instead of producing formatted or minified output, so you know exactly what needs fixing.

Can I control how much indentation is used?

Yes. Set the indent size field to anywhere from 1 to 8 spaces before clicking Format.

Does this tool validate XML against a schema, like an XSD or DTD?

No. It only checks that the XML is well-formed (correctly nested tags, matching quotes, and so on) — it doesn't validate the document's structure against a schema.

What does Minify do differently from Format?

Minify strips whitespace between tags and collapses the document to one line, while Format adds line breaks and indentation for readability — both first confirm the XML is well-formed.

Can I use the XML Formatter on my phone?

Yes. The page is fully responsive and works on mobile, tablet and desktop browsers alike.

Still have a question? Contact us

Report a problem

XML Formatter and Validator

What went wrong?
    or paste a screenshot