👀 Live Preview
How the title appears in a browser tab (mockup):

The <title> tag defines your page name for browsers and search engines. This guide covers syntax, placement in head, browser tabs, SEO, title vs h1, and best practices for beginners.
Write a valid <title> inside <head>.
Control the label users see on each tab.
Craft keyword-rich, descriptive page titles.
Know metadata title vs visible heading.
Keep titles concise for search snippets.
Unique, accurate titles on every page.
<title> Tag?The title element (<title>) defines the document title of an HTML page. It lives in the <head> section and is not visible on the page itself. Instead, browsers use it for tab labels, bookmarks, history entries, and search engine result headlines.
HTML requires exactly one <title> in <head>. Without it, the browser tab shows the file URL or a generic label—poor for users and SEO.
The title tag might look simple, but it is one of the most important elements for user experience and discoverability. A clear title tells visitors what page they opened before they even read the content.
Place <title> inside <head> with plain text content:
<!DOCTYPE html>
<html lang="en">
<head>
<title>Your Page Title</title>
</head>
<body>
<!-- Your page content here -->
</body>
</html><title> per document, inside <head>.<title>.—) for special characters.<title> (document metadata) with <h1> (visible page heading).| Topic | Rule / Pattern | Notes |
|---|---|---|
| Location | <head> only | Never in body |
| Count | Exactly one per page | Required in HTML |
| Content | Plain text | No child elements |
| Browser tab | Tab label | Also bookmarks & history |
| SEO length | ~50–60 characters | Avoid truncation in SERPs |
| vs h1 | title = metadata | h1 = visible heading |
<title> vs <h1>Beginners often mix these up. They serve different purposes:
| Feature | <title> | <h1> |
|---|---|---|
| Location | <head> | <body> |
| Visible on page? | No | Yes |
| Shown in browser tab? | Yes | No |
| Primary SEO role | Search result headline | On-page content structure |
| Example | <title>About Us — Acme Co</title> | <h1>About Our Team</h1> |
The <title> tag has no tag-specific attributes. Its content is typically plain text, but you can use HTML character entities for special characters:
<title>Learn HTML & CSS — Beginner Guide</title>Text content RequiredThe document title string. Keep it descriptive and unique per page.
Your Page TitleCharacter entities OptionalUse entities like &, —, or © in the title text.
—Global attrs Not usedclass, id, and style are invalid on <title> in valid HTML.
N/ABasic document titles, browser tab labels, and SEO-friendly titles with copy-ready code and live previews.
How the title appears in a browser tab (mockup):
The simplest use of <title>—a descriptive name inside <head>:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Your Page Title</title>
</head>
<body>
<h1>Welcome</h1>
</body>
</html>Developers use <title> for browser tab labels, bookmarks, search engine listings, and social sharing previews (via Open Graph, which often mirrors the title).
The text inside <title> is what appears on the browser tab when a user visits your page. It gives a concise, informative label before they read the body content:
<head>
<title>Contact Us — Acme Company</title>
</head>
<body>
<h1>Get in Touch</h1>
<p>We would love to hear from you.</p>
</body>Search engines use the <title> tag as the primary headline in search results. A meaningful, keyword-relevant title helps users find your page and can improve click-through rates:
<head>
<meta charset="UTF-8">
<title>HTML title Tag Guide — Browser Tabs & SEO | CodeToFun</title>
<meta name="description" content="Learn how to use the HTML title tag for browser tabs, bookmarks, and SEO.">
</head>h1 should reinforce (not duplicate verbatim) the document title for in-page context.Plain text inside <title> names the document.
The label appears on the tab, in bookmarks, and in browsing history.
Crawlers use <title> as the primary search result headline.
Users recognize your page in tabs and search; machines understand what the document is about.
The <title> tag is supported in all browsers, including legacy Internet Explorer. It has been part of HTML since the earliest web browsers.
Every browser renders <title> as the tab label and exposes it via document.title.
Bottom line: Use <title> on every page—it works everywhere.
The <title> tag might seem simple, but its impact on user experience and SEO is profound. Crafting well-thought-out, descriptive titles enhances the visibility of your web pages and contributes to a positive user journey.
Mastering the <title> tag is a fundamental skill for any web developer. Ensure every page has a unique, accurate title inside <head>, and pair it with a clear visible h1 in the body.
h1 alongside the document title<title><title> with <h1><title>Bookmark these before you publish your next page.
<title> names the page for browsers, bookmarks, and search engines.
Exactly one title element per document, never in the body.
PlacementSearch engines use title as the primary result link text.
SEOTitle is metadata; h1 is the visible on-page heading.
ComparisonWorks in every browser ever built for the web.
Compatibility<title> element defines the document title shown in browser tabs, bookmarks, history, and search engine results. It belongs in <head>.<title> inside <head>. It must not appear in <body>.<title> is metadata in head for tabs and SEO. <h1> is the visible main heading users see on the page in body.<title> as a primary ranking signal and as the clickable headline in search result listings.—) for special characters, not HTML tags.Practice <title> inside <head> in the Try It editor.
5 people found this page helpful