📋

XML Formatter & Validator

Pretty-print, minify, or validate XML — with clear error messages and one-click copy.

XML Input

Could not parse XML

Output

Output will appear here…

About this tool

A browser-based XML formatter, minifier, and validator. Paste any XML to instantly pretty-print it with configurable indentation (2 or 4 spaces), compress it to a single line, or check if it is well-formed. Error messages identify problems like unclosed tags, unquoted attributes, and missing root elements.

📐Pretty-print with 2 or 4-space indent
🗜️Minify to a single line
Well-formedness validation
🚨Clear error messages with problem details
📋Copy formatted output with one click
🔒100% browser-based using DOMParser

How to use it

Quick steps to get the most out of this utility.

  1. 1

    Paste your XML

    Drop in raw, compressed, or formatted XML.

  2. 2

    Choose a mode

    Format (pretty-print), Minify (compress), or Validate (check structure).

  3. 3

    Fix any errors

    If the XML is invalid, an error message explains exactly what is wrong.

  4. 4

    Copy the result

    Use the copy button to grab the formatted or minified output.

Common XML use cases

  • Configuration files: Maven POM files, Ant build scripts, Spring XML config
  • Data interchange: SOAP web services, RSS/Atom feeds, office formats (DOCX, XLSX)
  • Android resources: Layout files, string resources, AndroidManifest.xml
  • SVG images: Scalable Vector Graphics are XML under the hood

Frequently asked questions

What does XML formatting do?+

XML formatting (pretty-printing) adds indentation and line breaks to make compressed or one-line XML readable. It does not change the data, only the whitespace — so the formatted output is semantically identical to the input.

How is XML different from HTML?+

Both use tags, but XML is strict: all tags must be closed, attributes must be quoted, and the structure must be well-formed with a single root element. HTML is more forgiving. XML is used for data interchange; HTML is for web rendering.

What does XML validation check?+

The validator checks that the XML is "well-formed" — meaning proper nesting, closed tags, quoted attributes, and a single root element. It does not validate against an XML Schema (XSD) or DTD, which would require a server-side tool.

What is XML minification used for?+

Minifying XML removes all unnecessary whitespace to reduce file size. Useful for APIs and config files where bandwidth or storage matters and human readability is secondary.

Are XML namespaces supported?+

The formatter handles standard XML including namespace declarations (xmlns attributes). It does not resolve or validate namespace URIs — it treats them as regular attributes.

Keep exploring

More utilities and reading from Toolisk.