HTML Basics

HTML Headings

Master the art of structuring content with HTML headings - the foundation of accessible and SEO-friendly documents.

How do HTML headings h1 to h6 work?

HTML has six heading levels, <h1> (most important) to <h6> (least). They create the page's outline, which screen-reader users navigate by and search engines use to understand structure. Use one <h1> for the page's main title, then <h2> for sections and <h3> for subsections, without skipping levels.

<h1>Learn HTML</h1>
  <h2>Getting started</h2>
    <h3>Installing an editor</h3>
  <h2>Basic tags</h2>

Try It: Heading Hierarchy

Experiment with HTML headings to create a proper document structure. Notice how headings create a logical hierarchy.

Code Editor

<h1>Learn HTML</h1>          <!-- one per page -->
<h2>Getting started</h2>
<h3>Choosing an editor</h3>
<h3>Your first file</h3>
<h2>Core elements</h2>
<h3>Headings</h3>
<ul id="outline"></ul>

Preview

What Are HTML Headings?

HTML headings are elements that define the structure and hierarchy of your content. They range from<h1> (most important) to<h6> (least important).

The Six Heading Levels:

<h1>Main Title(Use only once per page)
<h2>Section Heading
<h3>Subsection Heading
<h4>Minor Heading
<h5>Small Heading
<h6>Smallest Heading

Why Headings Matter:

  • SEO Benefits: Search engines use headings to understand content structure
  • Accessibility: Screen readers use headings for navigation
  • User Experience: Clear content hierarchy improves readability
  • Content Scanning: Users scan headings to find relevant information

Creating Proper Hierarchy

A proper heading hierarchy creates a logical document outline that both humans and machines can understand.

Good Hierarchy

<h1>Page Title</h1>
  <h2>Chapter 1</h2>
    <h3>Section 1.1</h3>
    <h3>Section 1.2</h3>
      <h4>Subsection 1.2.1</h4>
  <h2>Chapter 2</h2>
    <h3>Section 2.1</h3>

Logical progression without skipping levels

✗Poor Hierarchy

<h1>Page Title</h1>
<h1>Another Title</h1>  WRONG
  <h4>Section</h4>      WRONG
    <h2>Subsection</h2>  WRONG
  <h6>Another Section</h6> WRONG

Multiple H1s, skipped levels, wrong order

Hierarchy Rules:

  • 1.Use only one H1 per page (page title)
  • 2.Don't skip levels (H1 → H2 → H3, not H1 → H3)
  • 3.Use headings for structure, not styling
  • 4.Make headings descriptive and clear

SEO & Accessibility Benefits

SEO Benefits

  • Content Structure: Search engines understand page organization
  • Keyword Targeting: H1 and H2 carry more SEO weight
  • Featured Snippets: Well-structured content appears in search results
  • Topic Clustering: Related headings boost content relevance

Accessibility Benefits

  • Screen Readers: Navigate by heading levels
  • Keyboard Navigation: Jump between sections easily
  • Content Overview: Users can scan document structure
  • WCAG Compliance: Meets web accessibility standards

Best Practices & Common Mistakes

Best Practices:

  • Use headings to create a logical document outline
  • Make headings descriptive and specific
  • Include relevant keywords naturally
  • Keep headings concise but informative
  • Use CSS for styling, not different heading levels

Common Mistakes:

  • ✗Using multiple H1 elements on one page
  • ✗Skipping heading levels (H1 → H3)
  • ✗Using headings purely for visual styling
  • ✗Empty or non-descriptive headings
  • ✗Too many heading levels (going beyond H4)

HTML Headings — step by step

1 / 4
1

Use h1 for the page title

Every page should have exactly one h1 element representing its main topic. This is the most important heading for both accessibility and SEO.

1 of 4
⚠️Only One h1 Per Page
Using multiple h1 elements on a single page dilutes the page's topic signal for search engines. Use h1 once for the page title, then use h2, h3, and deeper levels for sections and subsections.

🎯 Quick Check

How many h1 elements should a page ideally have?

HTML Headings: summary

Key points

  • Choose a heading level for its place in the structure, not its size. Change the size with CSS.
  • Skipping levels (an <h2> followed by an <h4>) confuses assistive technology.
  • Headings help SEO by signalling the topic of each section, especially the <h1>.

Common mistakes

  • Using <h1>–<h6> just to make text bigger or bold.
  • Making styled <div> or <p> elements look like headings, so they're invisible to screen readers.

Frequently asked questions

›Can a page have more than one h1?

HTML allows it, but one <h1> per page is the clearest structure for users, accessibility tools and SEO.

›Do headings affect SEO?

Yes. Search engines use headings to understand a page's topics. A clear <h1> and descriptive <h2>s help, but keyword stuffing doesn't.