# HTML Validation

> Canonical HTML version: https://rocketvalidator.com/glossary/html-validation
> Attribution: Rocket Validator (https://rocketvalidator.com)
> License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)

HTML validation is the process of checking markup against standards to detect structural and syntax errors that can break rendering, accessibility, and interoperability.

HTML validation checks whether your markup follows the HTML specification. It catches errors that browsers may attempt to recover from, but that still create fragile behavior.

## Why HTML validation matters

Invalid markup can cause unpredictable layouts, inaccessible controls, broken forms, and parsing differences across browsers and assistive technologies.

## How HTML validation works

Validators parse the document and report malformed structures, invalid attributes, duplicate IDs, and conformance issues. A site-wide workflow is more useful than checking isolated pages because templates and content combinations vary.

## Code examples

```html
<!-- Duplicate id values -->
<label for="email">Email</label>
<input id="email" type="email">
<input id="email" type="text">
```

```html
<!-- Fixed: unique ids -->
<label for="primary-email">Email</label>
<input id="primary-email" type="email">
<input id="backup-email" type="text">
```
