HTML <h1> to <h6> tags

Updated: 09/12/2023 by Computer Hope
HTML h1 to h6 tags

When writing in HTML (hypertext markup language), there are six levels of headers that can be defined and inserted into your code. The <h1> to <h6> tags are block elements used to designate headings of both different sizes and importance. For example, the h1 heading is the most important and often most prominent text, and h6 is the least important.


When thinking about document structure and SEO (search engine optimization), keep the following suggestions in mind. Every HTML page should have one H1 heading that is the first heading. Pages that need more than one heading should use the H2 - H6 headings and use them in order. For example, this page uses seven headings placed in the following order: H1, H2, H2, H3, H2, H2, and then H2.

The following sections contain information about these tags, including an example of how they're used and related attributes and browser compatibility.

Example of header code

<h3>Here is an H3 heading on Computer Hope</h3>

Example result

Here is an H3 heading on Computer Hope

Deprecated attributes

All HTML tags support standard attributes that define the settings of an HTML element. In addition to the standard settings, the <h1 to h6> tag had the following unique attributes that are now deprecated.

Attribute Description
align Designates the alignment of the content within a heading element.


Edge Internet Explorer Firefox Safari Opera Chrome
All versions All versions All versions All version All versions All versions

Browser, Code, Compatibility, Container tag, <head>, Web design terms