XML Formatter & Validator
Format XML with readable indentation and check XML syntax for common structural errors.
On this page
Free XML Formatter and Validator
This free XML Formatter and Validator turns difficult-to-read XML into clean, indented markup and checks it for well-formedness in your browser. It reports the parser’s line and column when the document has a structural error, so you can fix the right part of the file instead of searching through the whole document.
Paste XML, load a file, or start with the example
Paste XML into the input editor, choose Open XML file to read a local .xml file, or drag a file onto the drop area. Files are read locally and are not uploaded. Example fills the editor with a small catalog document, while Clear resets the input and output.
Format XML with the indentation you need
Format XML adds readable line breaks and indentation without changing the document’s elements, attributes, comments, or text values. Choose 2 spaces, 4 spaces, or one tab. Keep declaration controls whether an XML declaration at the start of the input is included in the result. Live format is enabled by default and updates the output when the input becomes well-formed. Turn it off when you want to edit first, then press Format XML or use the form action.
Check XML syntax and find the problem
Validate checks XML well-formedness with the browser XML parser. It catches common structural problems such as missing closing tags, incorrect nesting, duplicate or malformed markup, unquoted attributes, and extra content outside the root element. When the browser provides a position, the tool reports the line and column and selects that location in the input. A well-formed document is not automatically valid against an XSD or DTD, so this tool does not claim schema validation.
Minify, copy, or download the result
Minify removes formatting whitespace between structured elements while preserving meaningful mixed content, comments, CDATA, processing instructions, and text. Copy XML places the current output on the clipboard. Download XML saves it as formatted.xml. The output panel shows line and character counts and is capped at one million input characters for a responsive browser experience.
Inspect the document as a tree
After a successful parse, open the Tree view to inspect the document hierarchy with expandable elements. Text, comments, and CDATA are shown as separate nodes. The formatted output uses XML-safe text rendering, so markup from the input is not treated as page HTML.
Search, focus, and mobile editing
Find text searches the input or output and selects the next match. Ctrl+F or Command+F focuses the search field. The editor includes line numbers, caret position, font size controls, and full screen controls. On smaller screens, the input, actions, and output stack vertically so the controls remain usable without horizontal page scrolling.
Private browser processing
The XML stays in your browser while you work. This tool does not send the input to a server, fetch a URL, or run external schema validation. It checks well-formed XML only, which is the structural requirement that every XML document must meet before an application can process it.