Skip to content
HandfulTools

XML Formatter

Make XML readable — sitemaps, RSS feeds, SVG files, SOAP messages or configuration files — or compress it to a single line. Unclosed and mismatched tags are reported.

Runs in your browser

Loading…

How to use

  1. Paste your XML.
  2. Choose Beautify or Minify and the indentation.
  3. Copy the result.

How it works

The XML is split into tags, text, comments, CDATA sections and declarations by a tokenizer that respects quoted attribute values. Tags are then re-indented according to their nesting. Elements that contain only short text stay on one line, e.g. <title>Home</title>.

The formatter checks that every opening tag has a matching closing tag, but it does not validate against a DTD or XML Schema.

Examples

Sitemap
A one-line sitemap.xml becomes one <url> block per page with nested <loc> and <lastmod>.

Common uses

  • Reading sitemaps and RSS feeds
  • Cleaning up SVG code
  • Debugging SOAP and API XML responses

Privacy & security

This tool runs entirely in your browser. Your files and text are never uploaded to our servers — processing happens on your device and results are created locally. How each tool handles files

Frequently asked questions

Are comments and CDATA preserved?

Yes, they are kept exactly as written. Minify removes comments unless they are needed.

Can it format HTML?

Well-formed XHTML works. Regular HTML often has unclosed tags like <br> or <li>, which XML rules reject.

Last updated: