Since 2010 · Powering 2M+ tool runs every month
Since 2010
Add to Chrome

My Toolbox

Automatic Mode

No saved tools yet.

Go Premium
Related tools
Next step
XML to JSON Converter
More tools
JSON Formatter/ValidatorUUID Validator/DecoderTOML to JSON Converter
Home Page > Text Tools > Other Text Tools

XML Validator

Check document syntax with MiniWebtool’s XML Validator. Paste XML to test well-formedness and locate syntax errors by line, with element counts, attributes, and maximum nesting depth summarized for inspection.

Need help using this tool? Ask AI

For Gemini, paste the copied question into the chat. You can also copy it below.

View the question

Free to useNo sign-up requiredInstant Results
XML ValidatorTry it now — free ▼
Load the Bookstore example, press Validate XML, and the check ends green: well-formed, 11 elements, 2 attributes, depth 3

Paste XML or load a quick example, get a well-formed check with line and column for any syntax error, plus element, attribute, text node, comment and namespace counts, maximum depth and a document structure tree.

Well-Formed Check Instant Results Line Numbers Error Location Statistics
Quick Examples:
XML Editor
1

Embed XML Validator Widget

About XML Validator

Welcome to the XML Validator, a powerful online tool for checking whether your XML documents are well-formed. This validator instantly detects syntax errors, reports precise error locations, and provides document statistics to help you understand your XML structure. Whether you are a web developer, data analyst, or learning XML, this tool ensures your XML documents meet all fundamental syntax requirements.

At a Glance

XML Validator checks whether pasted XML is well-formed and reports syntax errors with line and column numbers. It also shows element counts, attribute counts, maximum depth and a structure tree.

XML Validator: features at a glance
FeatureWhat you getGood for
Well-formednessChecks for one root element, proper nesting, matching case-sensitive tags, quoted attribute values and escaped special characters. It does not check against a DTD or XSD schema.Catching syntax mistakes in XML files and API payloads
Error locationReports the error message with its line and column, and a Jump to Error button takes you to the problem line.Fixing one error at a time
Document statisticsShows element counts, attribute counts and the maximum nesting depth.Getting a quick sense of how large and deep a document is
Structure treeDisplays the XML hierarchy as a tree view.Understanding an unfamiliar document
FormattingA Format button auto-indents messy XML for readability.Cleaning up minified or hand-edited markup
Namespaces and samplesNamespace declarations (xmlns) are checked for syntax. Quick-example buttons load valid and invalid samples.Learning common XML errors

What is Well-Formed XML?

A well-formed XML document follows all the basic syntax rules defined by the XML specification. Unlike valid XML (which must conform to a schema), well-formed XML simply needs to be parseable by any XML processor. Here are the key rules:

XML Validator: What is Well-Formed XML?
RuleDescriptionExample
Single Root Document must have exactly one root element <root>...</root>
Proper Nesting Elements must close in reverse order of opening <a><b></b></a>
Matching Tags Opening and closing tags must match exactly (case-sensitive) <Name>...</Name>
Quoted Attributes All attribute values must be in quotes <item id="1">
Escaped Characters Special characters must use entity references &lt; &gt; &amp;

Features

  • Instant Validation: Check XML well-formedness with one click
  • Precise Error Reporting: Get exact line and column numbers for errors
  • Error Highlighting: Jump directly to the problematic line in your code
  • Document Statistics: View element counts, maximum depth, and attribute counts
  • Structure Visualization: See your XML hierarchy in a tree view
  • Code Formatting: Auto-format messy XML with proper indentation
  • Quick Examples: Test with pre-built valid and invalid XML samples
  • Iterative Correction: Fix one error at a time for easier debugging

How to Use This Tool

  1. Enter Your XML: Paste your XML code into the editor, or click a quick example button to load sample data.
  2. Optional Formatting: Click "Format" to auto-indent your XML for better readability.
  3. Click Validate: Press the "Validate XML" button to check your document.
  4. Review Results: If valid, you will see success confirmation with statistics. If there are errors, you will see the error message with line and column information.
  5. Fix and Repeat: For errors, click "Jump to Error" to see the problematic line, make corrections in the editor above, and validate again.

Tip: XML is case-sensitive. <Item> and <item> are different elements. Most XML errors are caused by mismatched tag names or unclosed elements.

Common XML Errors and Solutions

Mismatched Tags

This occurs when opening and closing tags do not match. Remember that XML is case-sensitive.

  • Wrong: <Name>John</name>
  • Correct: <Name>John</Name>

Unclosed Elements

Every opening tag must have a corresponding closing tag, or use self-closing syntax.

  • Wrong: <item>Text
  • Correct: <item>Text</item> or <item />

Unquoted Attributes

Unlike HTML, XML requires all attribute values to be quoted.

  • Wrong: <book id=123>
  • Correct: <book id="123">

Unescaped Special Characters

In XML text, < and & must be escaped; escaping > is optional.

  • Wrong: <formula>x < 5</formula>
  • Correct: <formula>x &lt; 5</formula>

XML Entity Reference Table

XML Validator: XML Entity Reference Table
CharacterEntityDescription
<&lt;Less than
>&gt;Greater than
&&amp;Ampersand
'&apos;Apostrophe
"&quot;Quotation mark

Frequently Asked Questions

What does it mean for XML to be well-formed?

Well-formed XML adheres to all XML syntax rules: it has exactly one root element, all tags are properly closed and nested, attribute values are quoted, element names are case-sensitive and follow naming rules, and special characters are properly escaped. A well-formed document can be parsed by any XML parser.

What is the difference between well-formed and valid XML?

Well-formed XML follows basic syntax rules and can be parsed. Valid XML is well-formed AND conforms to a specific schema (DTD or XSD) that defines allowed elements, attributes, and their relationships. This tool checks well-formedness. For schema validation, you need to specify a DTD or XSD.

Why do I get mismatched tag errors?

Mismatched tag errors occur when opening and closing tags do not match. Common causes include: typos in tag names (XML is case-sensitive, so <Name> and </name> do not match), forgetting to close a tag, or incorrectly nested tags. Always close tags in reverse order of opening.

How do I fix unexpected character errors?

Unexpected character errors usually mean special characters are not escaped. In XML, use &lt; for <, &gt; for >, &amp; for &, &apos; for ', and &quot; for ". Also check for invisible characters copied from word processors, and ensure the document uses valid encoding (UTF-8 recommended).

Can I validate XML with namespaces?

Yes, this validator handles XML with namespaces. Namespace declarations (xmlns attributes) are checked for proper syntax. However, this is a well-formedness checker, not a schema validator, so it verifies namespace syntax but not whether elements belong to the correct namespace as defined by a schema.

Additional Resources

Reference this content, page, or tool as:

"XML Validator" at https://MiniWebtool.com/xml-validator/ from MiniWebtool, https://MiniWebtool.com/

by miniwebtool team. Updated: Jan 14, 2026

Chat with your favorite AI

For Gemini, paste the copied question into the chat. You can also copy it below.

View the question

Other Text Tools:

Top & Updated:

YAML Formatter/ValidatorXML Sitemap GeneratorGraph Degree Sequence ValidatorView all →
Home Page > Text Tools > Other Text Tools > XML Validator