HTML Accessibility Converter
Convert HTML into accessible HTML by auto-fixing ARIA roles, form labels, table headers, keyboard support, and WCAG compliance issues.
About
Approximately 96% of home pages have detectable WCAG 2.1 failures. Missing form labels, unassociated table headers, absent ARIA landmarks, and elements only reachable by mouse exclude users who rely on assistive technology. Manual remediation across a full codebase consumes hours and introduces human error. This converter parses raw HTML through a rule-based engine that detects 12 categories of accessibility deficiencies and applies deterministic fixes: associating label elements with inputs via generated id attributes, injecting scope and headers on table cells, adding role and tabindex to interactive elements lacking keyboard access, and enforcing lang attributes at the document root. The tool approximates conformance improvements assuming well-structured source markup. Malformed nesting or JavaScript-generated DOM nodes fall outside static analysis scope.
Formulas
The converter applies a deterministic rule pipeline. Each rule Ri is a function that traverses the parsed DOM tree T and returns a set of issues Ii along with a mutation function Mi.
where T is the input DOM tree, Mi is the mutation for rule i, and T′ is the accessible output tree.
ID generation uses a collision-free scheme:
where counter is a monotonically increasing integer scoped to the conversion session, and tagName is the lowercase element name. The label association rule checks:
where hasExplicitLabel checks for a label[for] matching the input's id, hasImplicitLabel checks if the input is wrapped inside a label element, and hasAriaLabel checks for aria-label or aria-labelledby attributes.
Reference Data
| Rule ID | WCAG Criterion | Level | Issue Detected | Auto-Fix Applied |
|---|---|---|---|---|
| R01 | 1.1.1 Non-text Content | A | img missing alt | Adds alt="" |
| R02 | 1.3.1 Info and Relationships | A | input without associated label | Generates id, links label[for] |
| R03 | 1.3.1 Info and Relationships | A | th missing scope | Adds scope="col" or scope="row" |
| R04 | 1.3.1 Info and Relationships | A | td without headers | Links headers to th ids |
| R05 | 2.1.1 Keyboard | A | onclick without tabindex | Adds tabindex="0" and role="button" |
| R06 | 2.4.1 Bypass Blocks | A | No skip navigation link | Inserts skip-to-main link |
| R07 | 2.4.6 Headings and Labels | AA | Heading hierarchy skipped | Reports warning (no auto-fix) |
| R08 | 3.1.1 Language of Page | A | html missing lang | Adds lang="en" |
| R09 | 4.1.2 Name, Role, Value | A | Landmark elements missing role | Adds appropriate ARIA role |
| R10 | 4.1.2 Name, Role, Value | A | required without aria-required | Adds aria-required="true" |
| R11 | 2.4.4 Link Purpose | A | target="_blank" without indication | Adds rel="noopener noreferrer" and sr-only text |
| R12 | 1.3.1 Info and Relationships | A | fieldset without legend | Reports warning (no auto-fix) |
| R13 | 4.1.1 Parsing | A | Duplicate id attributes | Appends unique suffix |
| R14 | 2.4.2 Page Titled | A | Missing title element | Inserts placeholder title |
| R15 | 1.3.5 Identify Input Purpose | AA | Input missing autocomplete | Suggests autocomplete value |