Skip to content
Free tool

XML Formatter, Validator & Repair Tool

The XML Formatter checks your XML online for errors and reports their line and column, formats it with 2 or 4 spaces or tabs, minifies it, and uses Auto-Fix to repair common errors such as an unescaped & or a missing closing tag. It's free and requires no sign-up. Your XML is processed only in your browser and is not uploaded.

Built by Justin Schuessler

Config files sorted? Host your project on a VPS with full control.

100% local, no upload

Input

Output

Example result

What the report looks like in the XML Formatter

You paste XML, and the tool reports the first error with its line and column, fixes common errors with Auto-Fix, then formats the result. The example below is an intentionally faulty sample file; your findings depend on your XML.

Example · Example XML with intentional errors

1 error · 3 corrections

Input

server.xml
<server><name>ZAP & Friends</name><port>25565</port>

Output: findings and auto-fix

  • 1 error
  • Error · Line 1, column 19char '&' is not expected.

    “Validate” reports the first error. “Jump to error” takes the cursor straight to it.

  • OKEscaped an unescaped special character (e.g., “&”) in the text 1 times.

  • OKAdded a missing closing tag at the end of the document 1 times.

  • OKAdded missing XML declaration (<?xml version="1.0" encoding="UTF-8"?>).

Output after auto-fix, formatted

server.xml
<?xml version="1.0" encoding="UTF-8"?><server>  <name>ZAP &amp; Friends</name>  <port>25565</port></server>

Features

XML Formatter and XML Validator in one tool

For Minecraft plugin or FiveM resource configuration files, API responses, RSS/Atom feeds, or sitemaps—anywhere you edit or debug XML by hand.

Validate XML with line and column numbers

Automatically checks whether your XML is well-formed shortly after you enter it, shows the first error with its line and column, and highlights it in the editor.

Format XML (pretty print)

Indents your XML with 2 or 4 spaces or tabs. Comments, CDATA sections, and the XML declaration are preserved.

Minify XML

Removes line breaks and indentation between tags to produce a compact version of your XML.

Repair XML with Auto-Fix

Escapes special characters such as & and <, adds missing closing tags, combines multiple root elements, and adds or moves the XML declaration.

Upload or drop a file

Upload an XML file up to 10 MB or drag it directly into the input field.

100% local, no upload

Everything runs in your browser; your file is not sent to any server.

Background

What the XML Validator checks and Auto-Fix repairs

Validation, repair, and formatting go together: your XML must be well-formed before it can be formatted or minified.

Validate XML: well-formedness, not schema compliance

Well-formed XML has exactly one root element, closed and properly nested tags, and escaped special characters such as &amp; instead of a standalone &. The XML Validator checks exactly that and reports the first error with its line and column. It does not check whether your XML conforms to an XSD schema or DTD.

Repair XML with Auto-Fix

Auto-Fix escapes a standalone & or < in text and attribute values, adds missing closing tags and a missing > at the end of a tag, removes closing tags without a matching opening tag, wraps multiple root elements in a <root> element, and adds or moves the XML declaration. Your input remains unchanged; the repaired version appears in the output.

Format (pretty-print) or minify XML

Format indents your XML with 2 or 4 spaces or tabs. Comments, CDATA sections, and the XML declaration are preserved, and text mixed with tags remains unchanged. Minify removes line breaks and indentation between tags. Both require well-formed XML; otherwise, the tool reports the error with its line and column.

How it works

How to validate, repair, and format XML online

Five steps, with no sign-up or installation.

Step 1

Paste XML

Paste your XML into the input field, upload an XML file up to 10 MB, drag it into the field, or load the example.

Step 2

Find errors

The tool automatically checks whether your XML is well-formed shortly after you enter it, or you can click “Validate”. The first error appears with its line and column; “Jump to error” moves the cursor there.

Step 3

Repair with Auto-Fix

Click “Auto-Fix” to fix common errors automatically. Your input stays unchanged; the repaired version appears in the output, with a list of fixes above it.

Step 4

Format or minify

Choose an indentation of 2 spaces, 4 spaces, or tabs and click “Format”, or click “Minify” for a compact version.

Step 5

Apply result

Copy the result to your clipboard or download it as an XML file.

Discover more

More tools

FAQ

Frequently asked questions about XML Formatter

Brief answers about validation, formatting, and auto-fix.

Yes. You don't need an account or to install anything: the XML Formatter runs in your browser. Just paste your XML and get started.

No. All processing — validation, formatting, minification, and auto-fix — takes place only in your browser. No file is sent to any server, including ZAP-Hosting.

No. The tool checks whether your XML is well-formed: exactly one root element, properly closed and nested tags, and escaped special characters. XML is valid in the strict sense only if it also conforms to an XSD schema or DTD, which this tool does not check. It does not check domain-specific rules, such as those for e-invoices, either. The success message therefore refers to XML syntax.

Shortly after you stop typing, the tool checks your XML automatically. Alternatively, click “Validate”. It shows the first error with its line and column and highlights it in the editor. “Jump to error” moves the cursor straight there.

Auto-Fix escapes a standalone & as &amp; and a < in text as &lt;, including in attribute values. It adds missing closing tags and a missing > at the end of a tag, removes closing tags without a matching opening tag, wraps multiple root elements in a <root> element, and adds or moves the XML declaration. Your input remains unchanged; the output shows the repaired version and a list of corrections. Check the result anyway: an added tag is placed where the tool detects the error, not necessarily where you intended it.

Upload the file or drag it into the input field. The editor displays it with line numbers and syntax highlighting. Click “Format” to indent it with 2 or 4 spaces or tabs (pretty print). Comments, CDATA sections, and the XML declaration are preserved. Then copy the result or download it as an XML file.

Minify removes line breaks and indentation between tags to produce a compact version of your XML. Spaces that are part of the text content are preserved. As with formatting, your XML must be well-formed.

Uploads are limited to 10 MB. Since everything runs locally in your browser, the actual limit also depends on your device's performance.

Any more questions?

Contact Support
Building something of your own?

Your app or API needs a reliable server

A ZAP-Hosting VPS reliably puts your application or project online.

4.4/5 Trustpilot32,000+ Active serversSince 2010

No setup. No risk. Online in seconds.

Flexible TermCancel anytimeOnline in 60 seconds

Looking for more tools? View all developer tools