How Many Heading Levels in HTML: Complete Guide
HTML supports six heading levels, from
<h1> to <h6>. Each level represents a different importance, with <h1> being the most important and <h6> the least.Syntax
HTML headings use tags from <h1> to <h6>. The number indicates the heading level, where 1 is the highest (most important) and 6 is the lowest.
<h1>: Main heading, usually the page title.<h2>: Subheading under<h1>.<h3>to<h6>: Further sub-levels for organizing content.
html
<h1>Main Heading</h1> <h2>Subheading Level 2</h2> <h3>Subheading Level 3</h3> <h4>Subheading Level 4</h4> <h5>Subheading Level 5</h5> <h6>Subheading Level 6</h6>
Output
Main Heading
Subheading Level 2
Subheading Level 3
Subheading Level 4
Subheading Level 5
Subheading Level 6
Example
This example shows all six heading levels used in a simple article structure. It helps browsers and screen readers understand the content hierarchy.
html
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Heading Levels Example</title> </head> <body> <h1>Welcome to My Website</h1> <h2>About Us</h2> <h3>Our History</h3> <h4>Founding Year</h4> <h5>Key Events</h5> <h6>Details</h6> </body> </html>
Output
Welcome to My Website
About Us
Our History
Founding Year
Key Events
Details
Common Pitfalls
Many beginners make these mistakes with heading levels:
- Skipping levels, like jumping from
<h1>to<h4>without<h2>or<h3>. - Using multiple
<h1>tags on one page without clear structure. - Using headings only for styling instead of structure.
Proper heading order helps screen readers and improves SEO.
html
<!-- Wrong: Skipping levels --> <h1>Main Title</h1> <h4>Skipped Levels</h4> <!-- Right: Proper order --> <h1>Main Title</h1> <h2>Sub Title</h2> <h3>Sub Sub Title</h3>
Output
Main Title
Skipped Levels
Main Title
Sub Title
Sub Sub Title
Quick Reference
| Heading Tag | Level | Use Case |
|---|---|---|
| 1 | Main page title or most important heading | |
| 2 | Section titles under | |
| 3 | Subsections under | |
| 4 | Further subsections | |
| 5 | Minor subsections | |
| 6 | Least important headings |
Key Takeaways
HTML has six heading levels: to
to .
Use headings in order without skipping levels for clear structure.
Only one
per page is best for accessibility and SEO.
Headings define content hierarchy, not just style.
Proper heading use improves readability and screen reader navigation.