TEXT & DEVELOPER TOOLS
XML Formatter
Pretty-print messy XML with the indentation you choose, check that it is well formed, or minify it, with errors reported by line and column.
Quick answer: Set the language to XML, paste or open your file, choose an indent size, then format, validate or minify.
Use XML Formatter ↓Loading the tool…
How to use XML Formatter
- Set the language to XMLThe formatter also handles JSON and HTML. Choose XML so the strict well-formedness check is used.
- Paste or open the filePaste text, or open a .xml or .svg file up to 25 MB. It is read locally.
- Format, validate or minifyFormat adds indentation, Validate only reports problems, and Minify removes whitespace between tags, with an option to strip comments.
- Read any errorErrors include the line and column and a hint such as an unclosed tag or an unquoted attribute value.
About this tool
XML is unforgiving: one missing closing tag and the whole document is invalid. This formatter makes a dense or minified document readable, and tells you exactly where it breaks. It runs in your browser, so configuration files and API responses do not need to be pasted into a website that uploads them.
Common uses: Inspect configuration files, feeds, API payloads and document-style XML with consistent indentation and validation feedback.
Practical example: Format a well-formed sample first, then use the reported line and column information to locate missing closing tags or invalid nesting.
Important limitation: XML is strict about casing, nesting and entities. A formatted document can still be semantically wrong for the system that consumes it.
XML is parsed and formatted in your browser and is not uploaded. Read the privacy information.
Common reasons XML fails to parse
The most frequent causes are a tag that is opened but never closed, tags that overlap instead of nesting, attribute values without quotes, and special characters in text. A bare ampersand must be written as &, and a less-than sign inside text must be <. The error hint shows the line and column of the first problem, which is usually the real cause; later errors are often just consequences of it.
Formatting changes whitespace only. For most documents that is harmless, but in some formats, such as mixed-content text in a document, whitespace can be meaningful. If your document depends on exact spacing, compare the formatted version with the original before replacing it.
Minify is useful when you want to reduce the size of a payload or a configuration file. The tool reports how many bytes you saved. SVG files are XML too, so you can tidy or minify one here and see the savings.
Frequently asked questions
What does “well formed” mean?
The XML has valid nesting, matching tags, correct syntax and a single document root; it may still need schema-specific validation.
Does minifying XML change its data?
It removes presentation whitespace where possible but does not intentionally change the elements or attributes.
Is my text sent to a server?
XML is parsed and formatted in your browser and is not uploaded.
Does the validator check against a schema (XSD)?
No. It checks that the document is well formed, meaning properly nested and closed. Schema validation needs a separate tool.
Will formatting change my data?
It changes indentation and line breaks only. Tags, attributes and text are kept, although whitespace-sensitive content should be checked.
How large a file can I open?
Files up to 25 MB can be opened. Very large documents may be slow to display in the text box, depending on your device.