</>

XML Formatter

Format, minify XML - with mismatched-tag detection and line/column errors.

xml-formatter.tool
0 lines · 0 chars · 0B
Formatted result will appear here
Nothing you paste here is ever sent to a server - it all happens locally in your browser.
Overview

What is a xml formatter?

This tool formats (beautifies) messy or minified XML with consistent indentation, minifies XML down to a single compact line, and validates that XML is well-formed - catching issues like mismatched or malformed tags with the exact line and column where the problem is.

Quick start

How to use this tool

  1. 1Paste your XML, or upload an .xml file.
  2. 2Click Format to beautify with your chosen indent width, Minify to compress it, or Validate to just check it's well-formed.
  3. 3If there's a syntax error - like a mismatched closing tag - the exact line and column are shown.
  4. 4Copy the result or download it as a .xml file.
Where it helps

Common use cases

Cleaning up a single-line XML response or config file into something readable
Minifying XML before sending it over a network to reduce payload size
Catching a mismatched or malformed tag before it breaks a build or parser
Quickly checking whether an XML file is well-formed before using it
Good to know

Frequently asked questions

What counts as 'well-formed' XML here?

Every tag must be properly closed and correctly nested - an opening tag needs a matching closing tag with the same name (or be self-closing), and tags can't overlap incorrectly. This tool checks exactly that.

Does it check XML against a schema (XSD/DTD)?

No - this validates that the XML is syntactically well-formed, not that it conforms to a particular schema. Schema validation is a separate, more involved kind of check.

What happens with CDATA sections and comments?

Comments are recognized and removed during formatting. CDATA content is preserved as raw text within its element.

Is my XML uploaded anywhere?

No - formatting, minifying, and validation all happen entirely in your browser.

quick_facts.json

{

"runs_in_browser": true,

"data_sent_to_server": false,

"signup_required": false,

"price": "free",

"category": "Encoding"

}

Related tools

B64
No signup
Base64 Encoder

Encode text to Base64, with correct Unicode handling.

Open tool
B64
No signup
Base64 Decoder

Decode Base64 back to readable text, with correct Unicode handling.

Open tool
URL
No signup
URL Encoder

Percent-encode URLs and query strings, component or full-URI mode.

Open tool