Last Updated : 17 Jul, 2025
HTML headings are used to define the titles and subtitles of sections on a webpage. They help organize the content and create a structure that is easy to navigate.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, initial-scale=1.0">
<title>HTML</title>
</head>
<body>
<h1>This is the Main Heading</h1>
<h2>This is a Subheading</h2>
<h3>This is a Smaller Subheading</h3>
<h4>This is a Sub-Subheading</h4>
<h5>This is a Minor Subheading</h5>
<h6>This is the Smallest Heading</h6>
</body>
</html>
Note: the 'h' inside the tag should always be in lowercase.
HTML offers six levels of heading tags, each serving a different purpose in structuring your content:
<h1> – Main Heading (Largest)Example: Here’s how you can apply basic styles to HTML heading tags:
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, initial-scale=1.0">
<title>HTML</title>
</head>
<body>
<h1>H1 Heading</h1>
<!-- With the help of Style attribute you can customize
the size of the heading, As done below-->
<h1 style="font-size: 50px">H1 with new size.</h1>
<!-- Here font-size is the property by which we can
modify the heading. Here we kept it 50px i.e. 50 pixels -->
</body>
</html>
Output:
HTML Headings Example Output Best Practices for Using HTML HeadingsHTML Headings in Web Development
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4