Validate XML online with syntax highlighting. Format and detect errors in XML documents
XML document validation. Checks XML syntax correctness. Can also format (prettify) XML for easy reading.
Online XML Validator: Syntax Check and Formatter
This free online XML validator instantly checks your document for syntax errors, highlights problems with line numbers, and helps you format messy XML. Use it for config files, RSS feeds, API responses, and any XML data.
What is XML validation
XML (eXtensible Markup Language) is a universal format for storing and transmitting structured data. XML validation checks document correctness at two levels: syntactic correctness (well-formed) and schema conformance (valid).
Invalid XML causes parse errors, API failures, and data synchronization problems between systems. A validator catches errors before they appear in production.
Well-formed vs Valid XML
| Concept | What is checked | Tool |
|---|---|---|
| Well-formed | XML syntax: tags closed, attributes quoted, single root element | XML parser |
| Valid | Conformance to DTD, XSD, or RELAX NG schema | XML validator with schema |
A document can be well-formed but not valid — correct syntax but content doesn't match the schema (wrong data type, missing required element).
Common XML errors
| Error | Description | Example |
|---|---|---|
| Unclosed tag | Opening tag without matching closing tag | <name>John |
| Unescaped character | Special characters without entity encoding | <desc>Price > 100</desc> |
| Multiple root elements | XML allows only one root element | <a/><b/> |
| BOM or whitespace before declaration | Content before <?xml | (space)<?xml version="1.0"?> |
| Encoding mismatch | Declared encoding doesn't match actual bytes | charset=UTF-8 with Latin-1 bytes |
| Case mismatch | XML is case-sensitive | <Name>...</name> |
XML special character escaping: & → &, < → <, > → >, " → ", ' → '
XML use cases
- sitemap.xml — site maps for search engines
- RSS/Atom — content subscription feeds
- SOAP — XML-based web services protocol
- SVG — XML-based vector graphics
- Office Open XML — .docx, .xlsx, .pptx formats
- Android Layout — UI markup in Android Studio
FAQ
What's the difference between XML and HTML?
HTML describes content presentation in browsers with a fixed tag set. XML is a general-purpose data format with arbitrary tags. HTML tolerates unclosed tags and is case-insensitive; XML is strictly syntactic.
XML or JSON — which to use?
JSON is simpler, more compact, and faster to parse in JavaScript. XML is more powerful: supports namespaces, attributes, comments, schemas (XSD), and transformations (XSLT). XML is required for SOAP, sitemap, RSS, SVG, and legacy enterprise systems.
See also: JSON formatter, HTML entities.
Useful articles
WCAG Color Contrast: Website Accessibility Guide
A complete guide to color contrast: WCAG 2.1 standards, AA and AAA levels, calculation formula, practical examples of good and bad contrast, and how to fix accessibility issues.
CSS Border Radius: Rounding Element Corners
How to use border-radius: syntax, shorthand notation, elliptical corners. Online border-radius generator.