References

Beginner-friendly references for web development, with live, editable examples.

The HTML <title> tag

Element All modern browsers Updated
Quick answer

The HTML <title> element sets the document's title — shown in the browser tab, bookmarks, and as the clickable headline in search results. It lives in the <head>, there is one per page, and it is one of the most important on-page SEO elements.

Overview

The <title> element defines the page's title. Browsers show it in the tab and use it for bookmarks and history, and — most importantly for visibility — search engines display it as the clickable headline of your result in the listings.

It must be plain text, it sits inside the <head>, and there must be exactly one per document. Because it does so much SEO work, it is worth writing deliberately: give every page a unique, descriptive title, front-load the important words, keep it to roughly 60 characters so it is not truncated in results, and make sure it reflects the page's actual content.

Do not confuse it with the title attribute, which provides tooltip text on any element — they share a name but are completely different things.

Syntax

<head>
  <title>Contact Us — CodeShack</title>
</head>

Example

Live example
<title>HTML Reference: Tags, Attributes &amp; Examples — CodeShack</title>

Best practices

  • Write a unique, descriptive <title> for every page.
  • Front-load the important keywords and keep it to roughly 60 characters.
  • Make it reflect the page's actual content so it is useful in search results.
  • Do not confuse it with the title attribute, which is for tooltips.

Frequently asked questions

What is the title element?
It sets the document title shown in the browser tab, in bookmarks, and as the headline of the page's search result.
How long should an HTML title be?
Around 60 characters or fewer, so it is not truncated in search results. Front-load the most important words.
What is the difference between the title element and the title attribute?
The <title> element sets the page title in the head; the title attribute adds tooltip text to any element.
Why is the title element important for SEO?
Search engines use it as the headline of your result, so a clear, unique, keyword-relevant title directly affects click-through.