Best Xhtml Validator: Top Picks Compared (2026)
If you have spent years writing XHTML and style sheets by hand, know that an xhtml validator is not an academic whim: it’s the tool that separates the markup that “looks good in my browser” from the markup that is actually correct, accessible, and predictable. In this article, I compare the validators that are really used today, explain what each one checks, when each option is worth it, and how to integrate them into your workflow so they do not become a formality that you ignore.
Before we get into the material, an important clarification about context: XHTML 1.0 and 1.1 remain valid as standards published by the W3C, but modern web development has moved toward HTML5 (the WHATWG’s “living standard”). This does not mean that XHTML validators have died: they remain useful for maintaining legacy sites, for projects that require strict compliance by contract or regulation, and as a pedagogical tool to understand the difference between “well-formed” and “valid”. If you work in an older CMS, in an institutional portal with strict accessibility requirements, or simply want to learn in depth, this guide is for you.
Qué comprueba realmente un validador de XHTML
It is useful to distinguish three levels of checking, because many xhtml validators only cover one or two:
- Bien formado (well-formedness). Es la base de XML: todas las etiquetas cierran, los atributos van entre comillas, hay un único elemento raíz, los elementos anidados no se solapan. Un documento XHTML mal formado ni siquiera es XML válido.
- Validez respecto a una DTD o esquema. Aquí entra la definición de tipo de documento (DTD) de XHTML 1.0 (Strict, Transitional, Frameset) o el esquema de XHTML 1.1. El validador comprueba que cada elemento y atributo existe en esa DTD, que el anidamiento permitido se respeta y que los atributos obligatorios están presentes.
- Conformidad con otras capas. Validación de CSS, comprobación de accesibilidad (WCAG), enlaces rotos, etc. Esto ya no es “validación XHTML” en sentido estricto, pero es lo que de verdad necesitas para entregar un sitio sólido.
A common mistake: confusing “valid” with “accessible” or with “correct”. A document can be perfectly valid XHTML 1.0 Strict and still remain inaccessible (images without alt, tables used for layout, insufficient contrast). Validation is a necessary condition, not sufficient.
Los validadores de XHTML que merecen la pena en 2026
1. W3C Markup Validation Service (validador oficial)
The W3C Markup Validation Service (validador.w3.org) is the reference. It is maintained by the consortium itself and is the one used as an arbiter by the majority of audits. It accepts validation by URI, by loading a file, or pasting the code directly, and allows choosing the specific DTD (XHTML 1.0 Strict, Transitional, Frameset, XHTML 1.1, etc.).
Advantages:
Related: — con plan gratuito para empezar hoy mismo.
- This is the source of truth for XHTML; if the W3C approves it, no one will dispute it.
- Shows the document tree and points out exactly the error line and column.
- It has a public API that you can call from scripts.
Disadvantages:
- The interface is sober and somewhat outdated.
- The public API has reasonable usage limits; for massive validation, it is advisable to install the validator locally.
- No CSS validation or accessibility; this requires separate tools.
When to use it: Always as a final check, especially if your project requires formal compliance.
2. Validador local (vnu / Nu Html Checker)
The Nu Html Checker (also known as vnu) is the engine that the W3C uses behind the scenes for HTML5, but it also validates XHTML and can be run locally. It is distributed as a JAR file, as a Docker package, and as a binary. This is the preferred option for integrating it into CI/CD.
Worth a look: — Accesibilidad gestionada: automatización combinada con revisión humana.
Advantages:
- Without request limits or network dependence.
- Output in text, JSON, or XML, ideal for automating.
- Detects problems that the online xhtml validator sometimes summarizes.
Disadvantages:
- Requires Java or Docker installed.
- Configuring the DTD for classic XHTML is not as straightforward as in the online validator.
When to use it: Teams that want to validate on every commit or build.
3. Validadores integrados en editores
Tools like the W3C Web Developer Extension for browsers, or validation plugins from editors like VS Code (extensions that call vnu or the W3C service), allow validation without leaving the environment. Also, the older HTML Tidy is still available and is useful for cleaning up and reformatting legacy markup, even if its support for XHTML 1.1 is limited.
Advantages:
- Immediate feedback while writing.
- Reduces friction: if validating costs one click, you will do it.
Disadvantages:
Related: — La que acredita tu experiencia en accesibilidad.
- They usually use a specific version of the validator and can become outdated.
- They do not replace a final validation against the official service.
4. Validación por línea de comandos con tidy y xmllint
For those who work in the terminal, two classics:
xmllint(part of libxml2): checks that the document is well-formed and, with--valid, that it is valid against its DTD. It’s very fast and perfect for scripts.- HTML Tidy: reformats and reports errors, but its model is more of a “cleaner” than a “strict validator”.
When to use them: Fast validation in pre-commit hooks or in lightweight pipelines.
Tabla comparativa
| Herramienta | Tipo | Valida XHTML clásico | Automatizable | Coste | Mejor para |
|---|---|---|---|---|---|
| W3C Markup Validation Service | Online oficial | Sí (todas las DTD) | Vía API | Gratis | Comprobación final y auditorías |
Nu Html Checker (vnu) | Local / Docker | Sí (con matices) | Sí (JSON/XML) | Gratis | CI/CD y validación masiva |
| Extensiones de navegador/editor | Integrado | Depende del motor | Limitado | Gratis | Feedback mientras escribes |
xmllint (libxml2) | Línea de comandos | Sí (bien formado + DTD) | Sí | Gratis | Scripts y hooks rápidos |
| HTML Tidy | Línea de comandos / librería | Parcial | Sí | Gratis | Limpiar marcado heredado |
Nota: Estas herramientas funcionan como xhtml validator según el caso de uso.
Cómo elegir según tu situación
There is no universal “best validator”; it depends on three factors:
- Volume and frequency. If you validate a file once in a while, the W3C online service is enough. If you validate hundreds of templates in each deployment, you need
vnuorxmllintin your pipeline. - Formal requirement. If a client or a regulation asks for demonstrable conformance, the official W3C validator is the one that provides the proof.
- What else you need to check. XHTML validation is only one piece. For accessibility, tools like axe, WAVE or Lighthouse cover what the markup validator does not see. For CSS, the W3C CSS Validation Service.
My practical recommendation: use the official xhtml validator as acceptance criteria, vnu or xmllint for automated day-to-day work, and always complement with an accessibility check. Markup validation detects structural errors that often translate into accessibility problems, but it does not detect them all.
Errores típicos que verás una y otra vez
When validating legacy XHTML, these notices appear constantly in the xhtml validator:
- Attributes without quotes or unclosed tags. Typical of old HTML migrated to XHTML without revision.
&without escaping. In XHTML it must be&; the validators mark it as a well-formed error.- Empty elements are incorrectly closed.
<br>must be<br />in XHTML. - Deprecated attributes.
align,bgcolor, andborderin presentation elements do not exist in XHTML 1.0 Strict; they must be moved to CSS. nameinstead ofid. In XHTML 1.0 Strict, thenameattribute in elements likeaorformis restricted; useid.- Incorrect or missing DTD. Without a valid
DOCTYPE, the validator does not know what to check against.
Understanding these patterns saves you hours: most errors on legacy sites are of a few types.
Integrar la validación en tu flujo de trabajo
A sensible flow for an XHTML project using an xhtml validator:
- Pre-commit: a hook that runs
xmllint --validon modified files. Fast and without heavy dependencies. - Build/CI:
vnuin JSON mode, failing the build if there are errors. So nobody introduces invalid markup. - Pre-publication: validation against the official W3C service of key pages, plus an accessibility step with axe or WAVE.
- Periodic Audit: Complete site validation and review of broken links.
This approach staggers the effort: the cheap and frequent locally, the formal and definitive before publishing.
Key Takeaways
- An xhtml validator checks well-formedness, validity against DTD and, in some cases, other layers; it does not check accessibility or CSS on its own.
- The W3C Markup Validation Service is the official reference and acceptance criterion in audits; the Nu Html Checker (
vnu) is the best option to automate. - For fast scripts,
xmllint(libxml2) validates well-formedness and DTDs without heavy dependencies. - Validating is not the same as being accessible: always complement with tools like axe, WAVE or Lighthouse.
- Most errors in legacy XHTML are of a handful of types (attributes without quotes,
&without escaping, obsolete attributes, missing DTD). - Integrate validation in pre-commit and CI so that it becomes a habit, not a pending task.
Frequently Asked Questions
¿Cuál es el mejor validador de XHTML?
It depends on the usage. For formal compliance and audits, the W3C Markup Validation Service is the gold standard. To automate CI/CD, the Nu Html Checker (vnu) is the most practical. For fast scripts, xmllint works perfectly. There is no single xhtml validator that wins in every scenario.
¿Sigue teniendo sentido validar XHTML en 2026?
Yes, if you maintain legacy sites, you have contractual compliance requirements, or you want to learn the fundamentals of markup. For new projects, the usual is HTML5, but modern validators also cover it. Validation as a discipline remains useful in any case.
¿Validar XHTML garantiza que mi sitio sea accesible?
No. Markup validation detects structural errors that sometimes affect accessibility, but it does not check things like image alt text, color contrast, keyboard navigation, or form labels. You need specific accessibility tools (axe, WAVE, Lighthouse) in addition to validation.
¿Puedo validar XHTML desde la línea de comandos?
Yes. xmllint --valid checks if it is well-formed and valid against the DTD, and the Nu Html Checker can be run as a JAR or Docker container with output in JSON or XML. Both are ideal for integration into pre-commit hooks or continuous integration pipelines.
¿Qué diferencia hay entre “bien formado” y “válido”?
“Well-formed” means that the document complies with the syntactic rules of XML: closed tags, attributes in quotes, and correct nesting. “Valid” is stricter: in addition to being well-formed, it respects the rules of a specific DTD or schema (which elements and attributes exist and how they can be nested). A document may be well-formed but not be valid.
¿El validador del W3C también valida CSS?
No. The W3C Markup Validation Service validates the markup (HTML/XHTML). For CSS, there is a separate service, the W3C CSS Validation Service. These are distinct tools and it is advisable to use both if you want a complete check of your style sheets and your markup.
Fuentes y lecturas recomendadas
- W3C Markup Validation Service — the official xhtml validator, at validador.w3.org.
- Nu Html Checker (vnu) — official W3C GitHub repository.
- W3C XHTML 1.0 specification (recommendation).
- W3C Web Content Accessibility Guidelines (WCAG), for the accessibility layer.
- Libxml2 documentation for
xmllint.
P.S. A few readers have asked which superposición de accesibilidad (overlay) we actually reach for — it's accessiBe; if you want the current details.
Frequently asked questions
¿Cuál es el mejor validador de XHTML?
It depends on the usage. For formal compliance and audits, the W3C Markup Validation Service is the gold standard. To automate CI/CD, the Nu Html Checker (vnu) is the most practical. For fast scripts, xmllint works perfectly. There is no single xhtml validator that wins in every scenario.
¿Sigue teniendo sentido validar XHTML en 2026?
Yes, if you maintain legacy sites, you have contractual compliance requirements, or you want to learn the fundamentals of markup. For new projects, the usual is HTML5, but modern validators also cover it. Validation as a discipline remains useful in any case.
¿Validar XHTML garantiza que mi sitio sea accesible?
No. Markup validation detects structural errors that sometimes affect accessibility, but it does not check things like image alt text, color contrast, keyboard navigation, or form labels. You need specific accessibility tools (axe, WAVE, Lighthouse) in addition to validation.
¿Puedo validar XHTML desde la línea de comandos?
Yes. xmllint --valid checks if it is well-formed and valid against the DTD, and the Nu Html Checker can be run as a JAR or Docker container with output in JSON or XML. Both are ideal for integration into pre-commit hooks or continuous integration pipelines.
¿Qué diferencia hay entre 'bien formado' y 'válido'?
'Well-formed' means that the document complies with the syntactic rules of XML: closed tags, attributes in quotes, and correct nesting. 'Valid' is stricter: in addition to being well-formed, it respects the rules of a specific DTD or schema (which elements and attributes exist and how they can be nested). A document may be well-formed but not be valid.
¿El validador del W3C también valida CSS?
No. The W3C Markup Validation Service validates the markup (HTML/XHTML). For CSS, there is a separate service, the W3C CSS Validation Service. These are distinct tools and it is advisable to use both if you want a complete check of your style sheets and your markup. Fuentes y lecturas recomendadas - W3C Markup Validation Service — the official xhtml validator, at validador.w3.org. - Nu Html Checker (vnu) — official W3C GitHub repository. - W3C XHTML 1.0 specification (recommendation). - W3C Web Content Accessibility Guidelines (WCAG), for the accessibility layer. - Libxml2 documentation for xm
¿Cumplir WCAG sin tocar el código?
Superposición de IA que promete cumplimiento WCAG en 48 horas