Menu
×
   ❮     
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS DSA TYPESCRIPT ANGULAR ANGULARJS GIT POSTGRESQL MONGODB ASP AI R GO KOTLIN SWIFT SASS VUE GEN AI SCIPY AWS CYBERSECURITY DATA SCIENCE INTRO TO PROGRAMMING BASH RUST

Web Development - HTML Headings


HTML Headings

Headings are used to define titles and subtitles on a web page. They help both readers and search engines understand the structure of your content.

HTML includes six levels of headings, from <h1> (the most important) to <h6> (the least important).


HTML Heading Tags

Example

Six levels of headings:

<h1>This is heading 1</h1>
<h2>This is heading 2</h2>
<h3>This is heading 3</h3>
<h4>This is heading 4</h4>
<h5>This is heading 5</h5>
<h6>This is heading 6</h6>
Try it Yourself »

Browsers automatically add space before and after each heading. By default, <h1> is the largest and <h6> is the smallest.


Use Headings for Structure, Not Style

You should use headings to create a logical document structure, not just to make text larger or bold.

Think of headings as an outline:

Example

Structured page example:

<h1>My Website</h1>

<h2>About Me</h2>
<p>My name is John, and I love web development.</p>

<h3>Portfolio Website</h3>
<p>A website I built with HTML and CSS.</p>

<h3>JavaScript Quiz App</h3>
<p>An interactive app using JavaScript.</p>
Try it Yourself »

Tip: Use only one <h1> per page - it represents the main topic or title.


Heading and SEO

Search engines (like Google) use headings to understand the content hierarchy of your page. Good heading structure improves accessibility and makes your content easier to navigate.

  • <h1> - Page title
  • <h2> - Section titles
  • <h3> - Sub-sections

Example

SEO-friendly structure:

<h1>Healthy Recipes</h1>
<h2>Breakfast</h2>
<h3>Smoothies</h3>
<h2>Dinner</h2>
<h3>Pasta Dishes</h3>
Try it Yourself »

Summary

  • HTML provides six levels of headings: <h1> to <h6>
  • <h1> is the most important heading, <h6> is the least
  • Use headings for page structure, not for styling text
  • Headings help search engines and users navigate your content

Next, you'll learn about another fundamental element in HTML - paragraphs, which are used to display text on a page.

Next » HTML Paragraphs


×

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
sales@w3schools.com

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail:
help@w3schools.com

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookies and privacy policy.

Copyright 1999-2025 by Refsnes Data. All Rights Reserved. W3Schools is Powered by W3.CSS.