FormatBento

Code formatters & beautifiers

FormatBentoXML

XML formatter & validator

Check that XML is well-formed, then indent it neatly or squeeze it onto one line. Only the whitespace between elements changes; text, CDATA, comments and preserved spaces stay exactly as they were.

Mode
Empty
Output

The formatted code lands in this compartment. Ctrl + Enter formats from the keyboard.

Syntax error


						
					
Options

Ready. Paste code, open a file or press Sample.

Runs in your browser · nothing is uploaded

How it works

Your browser's own XML parser checks the document first. If it is not well-formed, you get its message with the line and column, the offending line, and a button that jumps there. Valid XML is then printed:

  • Pretty print puts each child element on its own line, indented by depth.
  • Minify removes the whitespace between elements and inside tags.
  • Elements that contain text (mixed content) are written back exactly, so <p>Hi <b>there</b></p> never gains stray spaces.
  • xml:space="preserve" keeps an element and its descendants as written.
  • Long start tags can wrap one attribute per line; values are never altered.

Questions

Does it validate against a DTD or XSD schema?

No. It checks well-formedness: matching tags, quoted attributes, one root element, declared entities. External DTDs and schemas are never fetched.

Can pretty printing change my data?

Only whitespace-only text between elements changes. If that whitespace matters to your application, mark the element with xml:space="preserve".

Does it work for SVG, RSS and config files?

Yes: any XML, including SVG, RSS and Atom feeds, sitemaps, Android layouts, .csproj and .config files.