HTML5 Guide
Semantic Document Hierarchy

HTML Headings (H1–H6): Semantic Outlines, WCAG Accessibility & SEO Architecture

Headings are the structural scaffolding of every web document. They provide a table of contents that guides visual readers scanning a page, search engine crawlers indexing topical relevance, and screen readers navigating digital content.

1. The Six Heading Levels Explained

TagImportance LevelSemantic RoleRecommended Usage
<h1>Primary (Highest)Main Document TitleExactly 1 per page. Summarizes the entire document or application view.
<h2>SecondaryMajor Section TitlesDivides the article into key conceptual chapters or thematic segments.
<h3>TertiarySub-Section TitlesNests under <h2> to detail specific subtopics.
<h4>Level 4Component / Detail TitlesNests under <h3> for specific subsections or deep widgets.
<h5>Level 5Sub-component TitlesUsed in complex scientific papers or multi-tier documentation.
<h6>Level 6 (Lowest)Granular Sub-itemsDeepest level of heading nesting supported natively by HTML.

2. Default Browser Typography Hierarchy

Heading 1 — Document Main Title

Default User Agent: ~2em (32px), bold, 0.67em margin

Heading 2 — Major Content Section

Default User Agent: ~1.5em (24px), bold, 0.83em margin

Heading 3 — Subsection Headline

Default User Agent: ~1.17em (18.7px), bold, 1em margin

Heading 4 — Detail Level Title

Default User Agent: ~1em (16px), bold, 1.33em margin
Heading 5 — Minor Subtitle
Default User Agent: ~0.83em (13.3px), bold, 1.67em margin
Heading 6 — Lowest Hierarchy Level
Default User Agent: ~0.67em (10.7px), bold, 2.33em margin

3. Proper Document Outlining vs Level Skipping Trap

A document outline represents a hierarchical tree. Skipping heading levels breaks this tree for non-visual assistive navigation:

✅ Valid Sequential Hierarchy

<h1>Frontend Engineering Manual</h1>
  <h2>1. CSS Architecture</h2>
    <h3>1.1 The Cascade</h3>
    <h3>1.2 Specificity Weights</h3>
  <h2>2. JavaScript Runtime</h2>
    <h3>2.1 Event Loop</h3>
      <h4>2.1.1 Microtasks</h4>
      <h4>2.1.2 Macrotasks</h4>

❌ Invalid (Skipped Levels)

<h1>Frontend Engineering Manual</h1>
  <!-- Skipped h2! Screen reader reports broken hierarchy -->
  <h4>1. CSS Architecture</h4>
  <!-- Skipped h3! -->
  <h6>1.1 The Cascade</h6>

Never jump from <h1> to <h4> simply because you desire a smaller font. Use CSS to size headings.

4. Search Engine Optimization (SEO) Architecture

  • Match User Intent: Search engines weigh words inside <h1> and <h2> heavily when identifying topical clusters. Align your primary keyword naturally in the <h1>.
  • Single H1 Standard: While HTML5 syntactically permits multiple H1s inside isolated <article> tags, Google Search Advocate guidelines explicitly confirm that a single, unambiguous <h1> provides the clearest signal of page intent.
  • Featured Snippet Optimization: Google often generates rich featured snippets and 'People Also Ask' accordions by pairing an <h2> or <h3> question with the immediate following <p> or <ol> answer.

Frequently Asked Questions (FAQs)

The <h1> element represents the overarching topic of the document. Having a single, descriptive <h1> establishes a clear root in the Document Outline for search engine algorithms (like Googlebot) and allows screen reader users to immediately identify the page's primary purpose. Sub-topics should branch out hierarchically into <h2>, <h3>, etc.

No. Skipping heading levels violates WCAG 2.2 Success Criterion 1.3.1 (Info and Relationships). Assistive technologies generate an outline tree based on heading numbers; skipping levels creates confusion for visually impaired users who may believe intermediate sections were lost or failed to load. Always step down incrementally (h2 -> h3 -> h4).

Never choose heading elements based on font size. Headings exist strictly to communicate structural hierarchy and semantic meaning. If an <h2> needs to appear smaller or larger, adjust its visual presentation via CSS font-size rather than demoting or promoting the tag level.

The original HTML5 specification proposed an automatic outline algorithm where nesting <h1> tags inside <section> or <article> elements would dynamically calculate their hierarchy level. However, no major browser vendor or screen reader ever implemented this algorithm. As a result, the WHATWG removed it, reinforcing the standard practice of manually assigning explicit <h1> through <h6> levels.

Explore Related Tools

Hand-picked utilities and calculators related to this tool.

Related Tools