Developer and Text Tools

How to Check HTML for Accessibility Errors Against WCAG 2.2

Learn the WCAG basics, find missing alt text, unlabeled inputs, empty buttons, heading jumps and low contrast in your HTML, and apply safe fixes.

Saizul Amin
Saizul Amin2 Nov 2026 · 4 min read
How to Check HTML for Accessibility Errors Against WCAG 2.2

How to Check HTML for Accessibility Errors Against WCAG 2.2

Accessibility problems are often visible in the markup long before anyone opens a screen reader. An image without alt text, a form field labelled only by its placeholder, an icon button with no name, or a div that responds to clicks but not to the keyboard: each one is a line of HTML that can be found and fixed early. This guide covers the basics of WCAG, the most common markup failures, and how to check code with a free in-browser checker.

WCAG in a nutshell

The Web Content Accessibility Guidelines 2.2 from the W3C are organised around four principles: content must be perceivable, operable, understandable and robust. Under these sit testable success criteria, each with a number such as 1.1.1 and a level: A, AA or AAA. Most laws and procurement rules point to level AA, which includes all A criteria too.

A few criteria account for many everyday failures:

  • 1.1.1 Non-text content – images and image buttons need a text alternative; decorative images get an empty alt="".
  • 1.3.1 Info and relationships – structure shown visually, such as labels, lists, table headers and headings, must also exist in the code.
  • 1.4.3 Contrast (minimum) – normal text needs a contrast ratio of at least 4.5:1, large text 3:1.
  • 2.1.1 Keyboard – everything that works with a mouse must work with a keyboard.
  • 2.4.4 Link purpose – link text such as "click here" says nothing out of context.
  • 4.1.2 Name, role, value – controls need an accessible name and a valid role.

ARIA attributes can fill gaps, but a wrong role or a reference to an id that does not exist makes things worse than no ARIA at all.

Checking markup with the tool

Open the Web Accessibility Code Checker and paste HTML into the editor or press Open HTML file. A summary shows how many errors, warnings and notices were found and how many can be fixed with one click.

The Issues tab lists each finding with its line, the WCAG criterion, the offending tag and a written fix. Errors are clear failures; warnings are probable problems that depend on context, such as alt text that looks like a file name; notices are best practices, such as having a single h1. You can hide a rule while you work through the rest.

Checks cover text alternatives for images, image buttons, map areas and inline SVG; labels, list structure, table headers, heading order and the main landmark; inline colour contrast; viewport settings that block zoom; click handlers on non-interactive elements; meta refresh, marquee and blink; page title and lang; empty or vague links; positive tabindex; and names and roles for buttons, iframes and ARIA usage.

Where a fix is mechanical, Apply fix shows the patched tag. The Fixed HTML tab applies every safe patch at once and leaves TODO placeholders where only a person can write the right text, such as the description of a photo. The Contrast checker tab calculates the ratio for any two colours, useful for colours defined in stylesheets. Results can be downloaded as a CSV report.

Worked example

Paste a simple pricing page. The checker reports that the html element has no lang, a hero image has no alt, the email field uses only a placeholder, an icon-only button has no name, a div acts as a button, the viewport meta disables zoom, some grey text sits well below 4.5:1 and an embedded map iframe has no title. It also warns that one image's alt is IMG_2041.jpg and that the headings jump from h1 to h3. Applying the one-click fixes resolves the mechanical ones; the remaining items, like writing real alt text and choosing a darker grey, need a human.

As a contrast reference, #777777 on white comes out just under 4.5:1, while #767676 just passes.

Tips and common mistakes

  • Use a real <button> instead of a clickable div; you get keyboard support for free.
  • A placeholder is not a label. It disappears when the user types.
  • Do not put aria-hidden="true" on anything that can receive focus.
  • Avoid positive tabindex values; fix the DOM order instead.
  • Write alt text for the purpose of the image in context, not a description of the file.

Limits

Automated checks catch only a share of accessibility issues. This tool reads markup only: it does not run JavaScript, load external stylesheets or see the rendered page, so it cannot test visible focus, reading order, colours set in CSS files or how a real screen reader behaves. A clean result is not a conformance claim. Always follow up with keyboard testing and assistive technology.

Completely freeNo cost, no sign-up
Files stay privateEverything runs in your browser
Easy in your languageAvailable in many languages