ToolBrigadeToolBrigade

XML Formatter

Format and validate XML with 2-space indentation, or minify it — uses the browser's DOMParser.

How to use this tool

  1. 1Paste XML into the left 'Input XML' panel.
  2. 2Click Format to pretty-print with 2-space indentation, or Minify to compact it.
  3. 3If the XML is invalid, a red error message appears below the buttons.
  4. 4Copy the result from the right Output panel.

About XML Formatter

Minified XML from API responses, config files, and data exports is nearly impossible to read. This formatter uses the browser's native DOMParser with the 'application/xml' MIME type to validate your XML first — if there's a syntax error, the parsererror element's text content is shown in red so you know exactly what went wrong. On valid XML, clicking Format applies a custom indentation algorithm that tracks nesting depth and adds 2 spaces per level. Clicking Minify strips all whitespace between tags using a regex. Both operations validate first, so you can't accidentally minify invalid XML. The output appears in a side-by-side panel with a Copy button. Developers debugging SOAP responses, working with RSS feeds, editing Maven pom.xml files, or formatting Android layout XML are the primary users. Runs entirely in your browser.

Frequently asked questions

Related Tools