Top 6 HTML Tags for SEO Every Developer Should Know
Tags: webdev, html, css, beginners
Published: 2022-09-13 15:25:19

This post was originally published on [Hackmamba](https://hackmamba.io/blog/2022/09/top-6-html-tags-for-seo-every-developer-should-know/)

Search engine optimization ([SEO](https://www.techtarget.com/whatis/definition/search-engine-optimization-SEO)) is a vital part of online marketing. It helps to make your website recognizable to search engines like Google, Yahoo, and Bing. Without SEO, your website will be relatively unknown. You will have fewer visitors, which translates to fewer customers. 

The main goal of SEO is to make your website rank higher in search engines. Thanks to SEO, users can easily find your website while looking for information related to your business.

It is essential to use HTML tags correctly when optimizing a website, and they play an important role in increasing your website's ranking and visibility.

This article will look at some of the most important HTML tags for SEO and how to use them. 

## Prerequisite

You'll need the following to follow along with this article:

- A basic understanding of HTML 
- An IDE on your computer - you can use [Visual Studio Code](https://code.visualstudio.com/download) 


## What Are the Important HTML Tags for SEO?

HTML tags for SEO increase your website's visibility to users and search engines. These Tags help you connect with your audience much more effectively. 

There are a variety of HTML tags you can use to improve the SEO of your website. Here is a few of them:

## Title Tags

An essential element of any website is its title tag. Title tags inform the user and search engines of the website's name and purpose. The title tag is usually the clickable **blue-colored** link in a search engine result page. 

In HTML documents, the title tag is always between the head elements:

```html
        <head>
            <title>Your Title</title>
        </head>
```

 
A **search engine results page (SERP)** displays the website's name and other related data. The SERP is the page that appears after typing a question into Google or any other search engine. 


![Titles on search engine results page](https://paper-attachments.dropbox.com/s_E48B564267ACC7D3F5931BD8FA7EA963948F5B6F4FE2DFB1B5ADEE1AB5695965_1653089746571_Untitled+design.png)


The title is the **blue-colored** links in the example above. Google would look at the page's title to determine the page's relevance to the user's search query. So if you search "What is HTML?" for example, all contents related to the definition of HTML will appear on the SERP.

[Google](https://developers.google.com/search/blog/2021/08/update-to-generating-page-titles) sometimes rewrites your title for you rather than using the title you provide. It occurs when your page answers the question, but the title does not fit the inquiry. The new page title can be from your heading elements, i.e., `<h1>` - `<h6>` elements, anchor text, or a completely new title.

**Note:** Google will use your title over 80% of the time. If you notice that Google changes your title for most queries, change it.

### How to Optimize Title Tag?

[Title tag optimization](https://developers.google.com/search/docs/advanced/appearance/title-link) best practices are as follows:

- Avoid using the same title for every web page on your website.
- Keep your titles short. It's unclear exactly how many characters Google can show on the SERP as it varies among screen sizes. It's advisable to keep your page titles within 55-70 characters long. That way, it will fit most screen sizes. Lengthy titles that appear in the SERP are likely to have parts truncated to 600 pixels.
- Avoid stuffing your title with too many keywords. While descriptive keywords can be helpful in your title, repeating them is unnecessary.


## Meta Description Tag

The [meta description tag](https://moz.com/learn/seo/meta-description#:~:text=Avoid%20double%20quotation%20marks%20in%20descriptions&text=To%20prevent%20this%20from%20happening,double%20quotes%20to%20prevent%20truncation.) summarizes your website's content on search engine results pages. It appears together with your page title in SERP.

Like the title tag, the meta description tag is always between the head elements in an HTML document:

```html
    <head>
        <meta name="description" content="page description"> 
    </head>
```


![Meta descriptions on search engine results page](https://paper-attachments.dropbox.com/s_E48B564267ACC7D3F5931BD8FA7EA963948F5B6F4FE2DFB1B5ADEE1AB5695965_1658622531101_Untitled+design.png)


The underlined texts in the example above are the meta descriptions of each page.

At times, Google may use a quote from your website instead of your meta description. It occurs when the quoted text matches a given query better than your meta description. Essentially, it will pick the best option to enhance your chances of getting clicks.

### How to Optimize Meta Description Tags?

If you fail to write a good meta description or fail to write one at all, Google will do it for you to match the search query. But it is vital to keep the following in [mind:](https://developers.google.com/search/docs/advanced/appearance/snippet#meta-descriptions)

- Keep your meta description short and descriptive. The length of your meta description changes according to the size of the screen, just like the title. For optimal screen compatibility, your meta description should not exceed 150–160 characters.
- Use the exact keywords from your title in your meta description.
- Avoid using quotation marks in your meta description. Google sees double quotation marks as a request to cut the texts at that point where you use it in the SERP. When using non-alphanumeric characters, use [HTML entity](https://www.w3schools.com/html/html_entities.asp) or avoid using non-alphanumeric characters.
- Use a different meta description for each page on your website.

**Note:** You can create titles and meta descriptions longer than the suggested lengths but to avoid having them get cut off, make sure your title and meta descriptions begin with your keywords. 


## Heading Tags (H1-H6) 

[Heading tags](https://www.w3schools.com/html/html_headings.asp) make it easier for readers and search engines to understand the contents of a web page. It helps structure the pages in a website and shows you how they're interconnected.

HTML has six heading tags, ranging from `<h1>` to `<h6>`.  The hierarchy goes from the most important to the least significant, with `<h1>` followed by `<h2>`, `<h3>`, `<h4>`, and so on.

The heading tags in your HTML document look like this:

```html
      <h1>First heading</h1> // Subject of the web page
      <h2></h2> // organize subsections of the web page
      <h3></h3> // organize subsections of the web page
      <h4></h4> // Add additional information
      <h5></h5> // Add additional information
      <h6></h6> // Add additional information
```

The size of each heading decreases with its importance. In hierarchy, `<h1>` is bigger than `<h2>`, `<h2>` is bigger than `<h3>`, and so on up to `<h6>`. 

### How to optimize Heading Tags?

[Heading Tags optimization](https://victoriousseo.com/blog/h1-tag-seo-importance/) best practices are as follows:

- Use heading tags in order. Go from `<h1>` to `<h2>` to `<h3>` and so on, on your web page. Search engines and online readers using a [screen reader](https://www.nomensa.com/blog/what-screen-reader) will find your page's content harder to understand if you skip heading levels.
- Keep your heading tags short and descriptive. It's best to keep your headings between 20-70 characters long.
- Use only one `<h1>` element per web page to avoid confusing search engines.


## Alt Attribute

[Alt attribute](https://www.w3schools.com/tags/att_img_alt.asp), also known as alternative texts, describes an image when it fails to load on a web page.

In HTML documents, the alt attribute is always part of an image element:

```html
    <img src=" image url" alt="image description"> 
```

Alt attributes improve image comprehension for users of assistive technology like [screen readers](https://www.nomensa.com/blog/what-screen-reader). Also, it makes your image accessible to search engines and provides context for those who want more information about your image.

### How to optimize Alt Attributes?

[Alt attribute optimization](https://moz.com/learn/seo/alt-text) best practices are as follows:

- Keep your alt texts [short and descriptive](https://www.washington.edu/doit/how-long-can-alt-attribute-be)
- Never leave the alt attributes empty
- Avoid using phrases. Don't use "image of" or "graphic of," for example, as the user is already aware that you are describing an image. 

## Canonical Tag 

A [canonical tag](https://moz.com/learn/seo/canonicalization) tells search engines which web page to show in SERPs. When you want one of two web pages with similar or duplicate contents to be the main page displayed on the SERP, you apply a canonical tag to that page.

HTML documents always have the canonical attribute between head elements:

```html
        <head>
            <link rel="canonical" href="website url"> // The URL of the website you want as the ma // in page 
        </head
```

### How to Optimize Canonical Tags?

[Canonical Tags optimization](https://developers.google.com/search/docs/advanced/crawling/consolidate-duplicate-urls) best practices are as follows:

- Use one canonical tag per page
- Always use [absolute URLs](https://developers.google.com/search/blog/2013/04/5-common-mistakes-with-relcanonical)
- Do not [block indexation](https://developers.google.com/search/docs/advanced/crawling/consolidate-duplicate-urls)

## Robots Meta Tag 

[Robots meta tags](https://developers.google.com/search/docs/advanced/robots/robots_meta_tag) instruct search engines on what pages to [index](https://www.codehousegroup.com/insight-and-inspiration/tech-stream/what-is-web-page-indexing) and what not to index.

In HTML documents, the robot tag is always between the head elements:

```html
<head>
      <meta name="robots" content="noindex"> // Do not show this page on the SERP
      <meta name="robots" content="noindex, follow"> // Do not index the page but follow th // e link to         
        other pages
     <meta name="robots" content="nofollow"> // Index the page but do not follow the link // to other pages 
     <meta name="robots" content="none"> // Do not follow or index this page
</head>
```

**NOTE:** The `name` and `content` attributes are not **case-sensitive**.

### How to Optimize Robots Meta Tags?

[Robots meta tag optimization](https://moz.com/learn/seo/robots-meta-directives) best practices are as follows:

- Address all bots with robots and individual bots with [individual bot names](https://developers.google.com/search/docs/advanced/crawling/overview-google-crawlers)
-  Use the different parameters such as Noindex, Nofollow, etc.


## Conclusion

This article has taught you the different types of HTML tags used for SEO and the best practices to follow.

## Resources

You will find the following resources helpful:

- [HTML tags in SEO](https://seranking.com/blog/html-tags-in-seo/)
- [How to optimize title tags for better ranking](https://www.greengeeks.com/blog/heres-how-to-optimize-your-title-tags-for-better-ranking/)