</>
ValidateHTML

Empty Heading Elements

An empty heading element (<h1>, <h2>, etc.) contains no text content. Screen readers announce headings to help users navigate the page structure, but an empty heading is announced as a heading with no content, which is confusing. Empty headings also break the document outline that assistive technologies use.

Why It Matters

Screen reader users rely on headings to navigate pages quickly. An empty heading creates a dead-end in navigation and suggests broken or incomplete content. It's a WCAG 2.1 Level A violation and indicates sloppy HTML structure.

Code Examples

Inaccessible
<!-- Empty heading -->
<h2></h2>

<!-- Heading with only whitespace -->
<h3>   </h3>

<!-- Heading with only an image, no alt text -->
<h2><img src="icon.svg"></h2>
Accessible
<!-- Heading with text -->
<h2>Our Services</h2>

<!-- Heading with image and alt text -->
<h2><img src="icon.svg" alt="Services"> Our Services</h2>

<!-- If you don't need a heading, don't use one -->
<p class="text-xl font-bold">Styled text, not a heading</p>

How to Fix

  • 1Add meaningful text content to every heading element.
  • 2If a heading contains only an image, add alt text to the image.
  • 3If you used a heading for styling purposes only, use a styled paragraph or span instead.
  • 4Remove empty heading elements entirely if they serve no purpose.

Check Your Accessibility Now

Our accessibility checker detects this issue automatically.

Open Accessibility Checker
Recommended

Hostinger Fast & Affordable Web Hosting

Deploy accessible, validated code on reliable hosting.

Get 80% Off Hosting →

Related Accessibility Errors

View all accessibility errors