HTML <title> Tag

Beginner
⏱️ 5 min read
📚 Updated: Jun 2026
🎯 3 Examples
Document Metadata

What You’ll Learn

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.

01

Title Syntax

Write a valid <title> inside <head>.

02

Browser Tabs

Control the label users see on each tab.

03

SEO Titles

Craft keyword-rich, descriptive page titles.

04

title vs h1

Know metadata title vs visible heading.

05

Length Limits

Keep titles concise for search snippets.

06

Best Practices

Unique, accurate titles on every page.

What Is the <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.

📄
Every HTML document needs a title

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.

📝 Syntax

Place <title> inside <head> with plain text content:

syntax.html
<!DOCTYPE html>
<html lang="en">
<head>
  <title>Your Page Title</title>
</head>
<body>
  <!-- Your page content here -->
</body>
</html>

Syntax Rules

  • Exactly one <title> per document, inside <head>.
  • Content is plain text only—no nested HTML elements inside <title>.
  • You may use character entities (e.g. &mdash;) for special characters.
  • The title tag has no tag-specific attributes.
  • Do not confuse <title> (document metadata) with <h1> (visible page heading).

⚡ Quick Reference

TopicRule / PatternNotes
Location<head> onlyNever in body
CountExactly one per pageRequired in HTML
ContentPlain textNo child elements
Browser tabTab labelAlso bookmarks & history
SEO length~50–60 charactersAvoid truncation in SERPs
vs h1title = metadatah1 = visible heading

⚖️ <title> vs <h1>

Beginners often mix these up. They serve different purposes:

Feature<title><h1>
Location<head><body>
Visible on page?NoYes
Shown in browser tab?YesNo
Primary SEO roleSearch result headlineOn-page content structure
Example<title>About Us — Acme Co</title><h1>About Our Team</h1>

🧰 Attributes

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-entities.html
<title>Learn HTML &amp; CSS &mdash; Beginner Guide</title>
Text content Required

The document title string. Keep it descriptive and unique per page.

Your Page Title
Character entities Optional

Use entities like &amp;, &mdash;, or &copy; in the title text.

&mdash;
Global attrs Not used

class, id, and style are invalid on <title> in valid HTML.

N/A

Examples Gallery

Basic document titles, browser tab labels, and SEO-friendly titles with copy-ready code and live previews.

👀 Live Preview

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

Basic Page Title

The simplest use of <title>—a descriptive name inside <head>:

basic-title.html
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Your Page Title</title>
</head>
<body>
  <h1>Welcome</h1>
</body>
</html>
Try It Yourself

📚 Common Use Cases

Developers use <title> for browser tab labels, bookmarks, search engine listings, and social sharing previews (via Open Graph, which often mirrors the title).

Browser Tab Display

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:

browser-tab-title.html
<head>
  <title>Contact Us — Acme Company</title>
</head>
<body>
  <h1>Get in Touch</h1>
  <p>We would love to hear from you.</p>
</body>
Try It Yourself

Search Engine Optimization (SEO)

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:

seo-title.html
<head>
  <meta charset="UTF-8">
  <title>HTML title Tag Guide — Browser Tabs &amp; SEO | CodeToFun</title>
  <meta name="description" content="Learn how to use the HTML title tag for browser tabs, bookmarks, and SEO.">
</head>
Try It Yourself

♿ Accessibility

  • Title is announced indirectly — Screen readers typically read the document title when the page loads, helping users confirm they landed on the correct page.
  • Make titles descriptive — Avoid generic titles like “Home” or “Untitled” when the page has a specific purpose.
  • Pair with a clear h1 — The visible h1 should reinforce (not duplicate verbatim) the document title for in-page context.
  • Unique per page — Identical titles on multiple pages confuse users relying on tabs, history, and assistive tech page lists.

🧠 How <title> Works

1

Author sets the title in head

Plain text inside <title> names the document.

Markup
2

Browser reads document.title

The label appears on the tab, in bookmarks, and in browsing history.

Browser UI
3

Search engines index the title

Crawlers use <title> as the primary search result headline.

SEO
=

A named, discoverable page

Users recognize your page in tabs and search; machines understand what the document is about.

Browser Support

The <title> tag is supported in all browsers, including legacy Internet Explorer. It has been part of HTML since the earliest web browsers.

Baseline · Since HTML 2.0

Universal document title support

Every browser renders <title> as the tab label and exposes it via document.title.

100% Core tag support
Google Chrome Fully supported
Full support
Mozilla Firefox Fully supported
Full support
Apple Safari Fully supported
Full support
Microsoft Edge Fully supported
Full support
Internet Explorer Fully supported · EOL
Full support
Opera Fully supported
Full support
<title> tag 100% supported

Bottom line: Use <title> on every page—it works everywhere.

Conclusion

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.

💡 Best Practices

✅ Do

  • Keep titles concise—ideally 50–60 characters for search results
  • Make titles unique and specific to each page
  • Accurately reflect the page content for users and SEO
  • Include your brand name at the end when helpful
  • Use a descriptive h1 alongside the document title

❌ Don’t

  • Use generic titles like “Home” on every page
  • Stuff keywords unnaturally into the title
  • Put HTML elements inside <title>
  • Duplicate the same title across unrelated pages
  • Confuse <title> with <h1>

Key Takeaways

Knowledge Unlocked

Five truths every developer should know about <title>

Bookmark these before you publish your next page.

5
Core concepts
🗃 02

Inside head

Exactly one title element per document, never in the body.

Placement
🔍 03

SEO Headline

Search engines use title as the primary result link text.

SEO
⚖️ 04

Not the h1

Title is metadata; h1 is the visible on-page heading.

Comparison
🌐 05

100% Support

Works in every browser ever built for the web.

Compatibility

❓ Frequently Asked Questions

The <title> element defines the document title shown in browser tabs, bookmarks, history, and search engine results. It belongs in <head>.
Place exactly one <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.
Aim for 50–60 characters so the full title displays in search results and browser tabs without being cut off.
Yes. Search engines use <title> as a primary ranking signal and as the clickable headline in search result listings.
No. The title element contains plain text only. Use character entities (like &mdash;) for special characters, not HTML tags.

Write your first page title

Practice <title> inside <head> in the Try It editor.

Try basic title example →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

5 people found this page helpful