Skip to main content
WizTools123
Free Online Tools

Tool Categories


Developer Tools New Tool

Free Online XML Formatter and Validator, Pretty Print and Minify

Make XML readable or squeeze it back to one line, and find out exactly where it is broken. The error gives a line and a column rather than a vague complaint, and text mixed in with tags is left on one line so that indenting never changes what the document actually says.

Free Forever Nothing Uploaded Line and Column Errors Mixed Text Untouched
Free Online XML Formatter and Validator, Pretty Print and Minify
Share this tool
Advertisement Slot (Top Banner) Google AdSense Unit • Responsive Banner
XML Formatter & Validator Everything happens in this tab. Nothing you paste is sent anywhere.
Your XML
Formatted
Output

Well formed XML.

root - 0 elements 0 attributes 0 levels deep

Buy Us A Coffee

Enjoying WizTools123? Help keep our server infrastructure 100% free and open for everyone.

Buy Us A Coffee
Sponsored Content (Below Tool) Google AdSense Placement

Well Formed Is Not the Same as Valid

This page checks the first one, and says so plainly.

XML has two separate ideas of correct, and they get mixed up constantly. Well formed means the syntax holds together: every tag closes, they nest in the right order, attributes are quoted, there is exactly one root. Valid means the document also matches a schema, a DTD or an XSD, which says which elements are allowed where, how many there may be and what may go in them.

This page checks that it is well formed, using the browser's own XML parser. It does not check it against a schema, because that would mean fetching your schema from wherever it lives, and a page that sends your document somewhere is exactly what this set of tools is not. Most of the time "my XML is invalid" turns out to mean a missing closing tag or a stray ampersand, and that is the part this finds.

How to Format and Validate XML

A few steps, and nothing is uploaded.

1
Paste your XML Minified, hand-edited, or straight out of an API. It is formatted as you type and nothing is uploaded.
2
Choose how it comes out Two spaces, four, or a tab. Or minify it to a single line for transport.
3
Read the check Well formed XML gets a tick and a count of its elements, attributes and depth. A mistake gets a line and a column.
4
Copy or download Or press Use as input to run another pass, such as minifying what you just indented.

What to Know About XML

Including the one thing most formatters get wrong.

Text mixed in with tags is never reflowed. In <p>Hello <b>world</b></p> the space before the tag is part of your content. A formatter that indents that onto separate lines has quietly added whitespace to the text, and in XML whitespace inside an element is real. Any element that contains actual text is written on one line instead.
Well formed is checked; valid against a schema is not. The browser's parser confirms the syntax holds together. Checking a document against a DTD, XSD or RELAX NG schema needs that schema, which usually lives on a server, and fetching it would mean sending your document off this page.
The XML declaration is kept exactly as you wrote it. The parser drops <?xml version="1.0"?> because it is not part of the document tree, so it is taken from your original text and put back on the first line unchanged, encoding and all.
Entities are re-escaped, which can look like a change but is not. An ampersand you wrote as &amp; comes back as &amp;, and a literal one that the parser accepted comes back escaped too. The document means the same thing; it is simply written the way XML requires.

Key Features & Capabilities

What this tool does, and what it deliberately does not.

Indent or minify Two spaces, four, or a tab, or squeezed to a single line.
Errors with a position A line and a column, taken from the browser's own parser.
Mixed text left alone Elements containing text stay on one line, so your content is untouched.
Shows the shape The root name, element and attribute counts, and how deep it nests.
As you type No run button. The result and the verdict update while you edit.
Nothing uploaded A SOAP response or an export often holds real data; it stays in your tab.

About the XML Formatter

XML turns up in the places that have been running longest: SOAP responses, RSS feeds, configuration files, sitemaps, office documents, bank messages. It is verbose by design, and when it arrives with no line breaks it is genuinely unreadable. Indenting it by hand is not an option once it is more than a few hundred characters long.

This formats and checks it in your browser. Pick an indent, or minify it back down for transport, and get a count of what is in the document. The parsing is done by the browser's own XML parser, which is fast and exactly correct; the indenting is written here, because no browser will do that part for you.

The care went into one thing above all: not changing what the document says. Whitespace inside an XML element is content, not decoration, so any element that holds real text is left on a single line rather than being spread out prettily. That is the difference between a formatter you can run on a file you are going to ship and one you can only use to have a look.

Frequently Asked Questions

Well formed versus valid, mixed content, and where your error is.

No. It checks that the document is well formed, which is the syntax: tags closed, nested properly, attributes quoted, one root element. Validating against a DTD, XSD or RELAX NG schema is a different job that needs the schema itself, and fetching it would mean sending your document off this page. In practice most XML problems are syntax, and that is what this finds.

Because it is mixed content: an element that contains both text and tags. Indenting those onto separate lines would add whitespace inside your text, and in XML that whitespace is part of the content. So any element holding real text is written on one line. It is deliberate, and it is the reason this can be run on a document you are about to send.

The message gives the line and the column reported by the browser's parser, followed by what it objected to. The most common causes are a tag that is never closed, two tags that overlap instead of nesting, an unquoted attribute, or a bare ampersand that should have been written as &amp;.

Two harmless reasons. Special characters are escaped the way XML requires, so a literal ampersand comes back as &amp;. And empty elements are written as a self-closing tag unless you turn that off. Neither changes what the document means to anything reading it.

No. It is parsed and formatted by your browser. XML is often a SOAP response, an invoice or an export with real data in it, and none of it leaves your tab. You can confirm that in the Network tab, or by turning off your wifi and using the page anyway.

Every Other Developer Tool

88 more tools in this set. All free, all in your browser.

Advertisement Slot (Bottom Banner) Google AdSense Unit • Responsive Banner