Free XML DTD Validator Online
Validate XML against DTD declarations instantly in your browser.
XML Input
DTD Input
Validation Result
What Is XML DTD Validation?
If you work with XML feeds from older enterprise systems, you've probably hit a wall where the document just won't validate and nobody remembers what the DTD expects. DTD (Document Type Definition) is the original grammar mechanism baked into the XML 1.0 specification -- it declares which elements are allowed, their ordering, and what text content rules apply. DTD is still everywhere in legacy publishing workflows, XML-based document pipelines, and toolchains that rely on DOCTYPE-based validation.
This validator helps you quickly verify practical DTD alignment: root declaration presence, undeclared elements, and missing required children in straightforward sequence models. For richer type constraints and modern contracts, use XML XSD Validator.
How to Use This Tool
Paste XML and DTD
Add XML in the left panel and DTD declarations in the middle panel. Start with sample content if you need a quick template.
Run DTD Checks
Click Validate to compare declared elements against the XML document structure.
Fix and Re-run
Resolve missing declarations or missing required child nodes, then validate again. Use XML Tree Viewer to inspect hierarchy before editing DTD rules.
DTD vs XSD
DTD is compact and widely supported in old systems, but it has limited datatype control. XSD is more expressive and namespace-friendly. If you are modernizing XML pipelines, validate quickly with DTD first, then migrate contracts to XSD where possible. The <a href="https://en.wikipedia.org/wiki/Document_type_definition" target="_blank" rel="noopener">DTD Wikipedia article</a> covers the history and syntax differences in more detail.
Validation Example
Example: Note document validated against a DTD
XML document:
<?xml version="1.0"?>
<!DOCTYPE note SYSTEM "note.dtd">
<note>
<to>Alice</to>
<from>Bob</from>
<body>Meeting at 3 PM</body>
</note>DTD definition (note.dtd):
<!ELEMENT note (to, from, body)>
<!ELEMENT to (#PCDATA)>
<!ELEMENT from (#PCDATA)>
<!ELEMENT body (#PCDATA)>Frequently Asked Questions
How do I validate XML against a DTD online?
Paste your XML in the left panel and your DTD declarations in the middle panel, then click Validate. The tool checks root declarations, undeclared elements, and missing required children -- all locally in your browser per the XML specification rules.
Can I use inline DOCTYPE DTD snippets?
Yes. Paste your <!ELEMENT> and <!ATTLIST> declarations directly into the DTD panel without wrapping them in a DOCTYPE block.
Is my XML data sent to a server?
No. All DTD validation processing happens entirely in your browser. Nothing is uploaded, so it's safe to use with production feeds, sensitive payloads, or internal documents.
What is the difference between DTD and XSD validation?
DTD is the original XML grammar from the W3C XML 1.0 spec -- compact and widely supported, but limited in datatype control. XSD (XML Schema) adds richer type constraints and namespace support. Use DTD for legacy systems and XSD for modern contracts.
What should I check before running DTD validation?
Run the XML Validator first to confirm your document is well-formed XML. DTD validation assumes valid XML syntax as a starting point.
Related Tools
References: XML 1.0, XML 1.1, DTD in XML spec, MDN XML Guide.