What does it mean if my web page has broken HTML?

When a check reports that a page could not be read properly, it usually means the HTML is so malformed, or so far from what a page normally looks like, that an automated reader could not make sense of it. Browsers are forgiving and will usually display something, but search engines and assistive technology are less so, and a page that cannot be read reliably cannot be understood reliably.

Why it matters

Browsers repair broken markup silently, and different browsers repair it differently, so the page may look fine in one and odd in another. Screen readers depend on the structure to announce headings, lists, links and regions; when the structure is broken they announce something else. Search engines extract the title, description, headings and links from the same structure. Errors also tend to cluster: a page with badly nested tags often has missing alt text and headings out of order too.

What usually causes it

  • Content pasted from Word or another site, carrying its own tags.
  • A plugin or embed code injecting unclosed tags.
  • A theme with a template error, so part of the page is repeated or cut off.
  • The address returning something other than a web page: a PDF, an image or a JSON response.
  • A page served entirely by JavaScript, with nothing in the HTML until scripts run.

How to check

Our check parses the page with a standard HTML parser and reports when it finds no usable document. The W3C Markup Validation Service lists individual errors with line numbers. View the page source in a browser and look for tags that open and never close, or content that appears twice.

How to fix it

For pasted content, clear the formatting and re-enter it using the editor's own tools; WordPress's "paste as text" option helps. For plugin and embed problems, disable plugins one at a time until the page validates. Template errors need a developer. If the page is built entirely by JavaScript, make sure the server sends the real content in the HTML as well, so that search engines and checkers see it.

Not sure how your own site does on this? Run the free check: it takes about twenty seconds and reports on this and thirty other things.

Check my website

More guides