XML Formatter
Paste XML to pretty-print or minify it. Choose your indent width while preserving attributes, text, and CDATA.
How to Use
Paste XML
Paste or type your XML into the input field. You can also load an example with the Sample button.
Choose Indent
Select your preferred indent width: 2 spaces, 4 spaces, or a tab.
Format or Minify
Use Format (Pretty) for readability or Minify to compact it onto a single line.
Copy the Result
Copy the output with one click using the Copy button.
About the XML Formatter
A web tool that pretty-prints XML (Extensible Markup Language) into a readable, indented form, or minifies it by removing extra whitespace and line breaks. It parses your XML with the browser's built-in XML parser, preserving attributes, text, and CDATA sections. If the XML has syntax errors, it falls back to a line-based format and shows the error. All processing happens in your browser and your XML is never sent to any server.
Features
- Format & MinifyPretty-print for readability or minify to reduce size. Pick the mode that fits your task.
- Selectable IndentChoose 2 spaces, 4 spaces, or a tab to match your team's coding style.
- Preserves Attributes & CDATAKeeps attribute values, text, CDATA, and comments intact, with proper quote escaping.
- Privacy ProtectedAll processing happens in your browser. Your XML is never sent to servers.
Use Cases
- Make API responses and SOAP messages readable
- Inspect RSS/Atom feeds and sitemap.xml
- Format config files (pom.xml, web.config, AndroidManifest.xml, etc.)
- Expand minified XML to debug and diff
- Minify XML before delivery to reduce file size
FAQ
Is the XML Formatter free to use?
What is the difference between Pretty and Minify?
Can it format XML that has syntax errors?
Are attributes, CDATA, and non-English text preserved?
Is my XML sent to a server? Is it safe?
Feedback
Missing a feature, or getting a result that looks wrong? Let us know — we improve our tools based on your feedback.