XML Editor and Formatter
Write or open an XML document, validate it with precise error positions, then format or minify it — all in your browser. No uploads, no external entities, no network requests.
Indentation uses two spaces. Formatting and minifying replace the editor content only after the document has parsed successfully.
How to use
- Paste XML into the editor, or press Open .xml file to load a local file (up to 10 MiB).
- Press Validate to check well-formedness. Errors are shown with line and column, the parser's reason, and the offending line.
- Press Format for readable indentation, or Minify to strip insignificant whitespace between elements.
- Copy the result or Download .xml to save it.
What formatting does — and does not — change
- Only whitespace between elements is rewritten. Element names, attributes and their values, comments, processing instructions, and CDATA sections are preserved.
- Text content is never trimmed, re-wrapped, or re-encoded. Elements that contain only text (
<title>Example</title>) stay on one line. - Mixed content — text and child elements side by side, such as
<p>Hello <b>world</b>!</p>— is left exactly as written, because inserting line breaks there would change the text. - The XML declaration and a plain DOCTYPE are kept at the top of the output.
- If the document is not well-formed, nothing is replaced: your original text stays in the editor until you fix the error.
Security and limits
- No external entities. Documents containing
<!ENTITY …>declarations or a DOCTYPE withSYSTEM/PUBLICreferences are rejected before parsing with a clear message. The tool never fetches DTDs, schemas, or any other resource. - No network requests. Opening or editing an XML file cannot cause a remote request — there is nothing on this page that talks to a server.
- Files opened with the file picker: up to 10 MiB, read as UTF-8.
- Not included in this version: XSD or DTD validation, XPath queries, XML-to-JSON conversion, and syntax highlighting.
Frequently asked questions
What does this XML editor do?
It is a lightweight editor for checking and tidying XML: validate well-formedness, format with two-space indentation, minify, and copy or download the result. It works entirely in your browser.
How are errors reported?
Validation reports the first problem with its line and column number, the parser's explanation (for example, a mismatched closing tag or an unescaped &), and a copy of the offending line, so you can jump straight to the fix. The editor content is never overwritten while it is invalid.
Does formatting change my document's meaning?
No. Only whitespace between elements is adjusted. Text nodes, attribute values, comments, and CDATA sections are kept as they are, and elements with mixed text and markup are left untouched. If a document cannot be formatted safely, the tool says so and keeps the original.
Why was my document with a DOCTYPE or ENTITY rejected?
Entity declarations and external DTD references are the classic way XML processors get tricked into reading local files or contacting remote servers (XXE). This tool refuses such input up front instead of trying to interpret it. A plain <!DOCTYPE name> without declarations is accepted and preserved.
Can it validate against an XSD or run XPath?
Not in this version. The editor checks well-formedness only. Schema validation, XPath, and XML-to-JSON conversion are out of scope for now.
Which encodings are supported?
Text pasted into the editor is already Unicode. Files opened with the file picker are read as UTF-8; a file saved in another encoding may show garbled characters and should be converted to UTF-8 first.
Is my XML uploaded anywhere?
No. Parsing, validation, formatting, and minifying happen locally in your browser. This page loads no third-party scripts and makes no network requests with your content.