Skip to main content

Advanced HTML

HTML Meta Tags for SEO

Written by Updated HTML Meta Tags for SEO exercises

Meta tags are short lines in the head of your page that only machines read: search engines, browsers and social sites. Visitors never see them, but they decide how your page looks in Google results and when someone shares the link.

Not every meta tag still matters. Some help a lot, some do nothing, and one, keywords, has been ignored by Google for over a decade. Here is what is worth your time.

html

<meta name="name" content="value">

Most meta tags have a name (what kind of information it is) and a content (the information itself).

Example: Common SEO Meta Tags

html

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>HTML Meta Tags for SEO</title>
  
  <meta name="description" content="Learn how to use HTML meta tags to improve your website SEO, visibility, and click-through rate.">
  <meta name="keywords" content="HTML, meta tags, SEO, description, keywords">
  <meta name="author" content="HTML5 & CSS3">
  
  <meta property="og:title" content="HTML Meta Tags for SEO">
  <meta property="og:description" content="Understand the importance of meta tags for SEO and how they help search engines rank your site.">
  <meta property="og:image" content="seo-thumbnail.jpg">
  <meta property="og:url" content="https://html5andcss3.org/html-meta-tags">
  
  <meta name="robots" content="index, follow">
</head>
<body>
  <h1>HTML Meta Tags for SEO</h1>
</body>
</html>

The ones that matter most

Meta Description

html

<meta name="description" content="A short summary about your web page for search results.">

This is often shown as the grey text under your title in Google. Google does not use it for ranking, but a clear description gets more clicks. Write a unique one for every page, about 150 characters, and describe what the reader will get. Google may still write its own snippet if it thinks another part of the page fits the search better.

Meta Viewport (for Mobile SEO)

html

<meta name="viewport" content="width=device-width, initial-scale=1.0">

Without this, phones show your page zoomed out, as if on a desktop screen. Every page needs it.

Meta Charset

html

<meta charset="UTF-8">

Tells the browser how to read the characters in the file. Put it first in the head, so symbols and other languages display correctly.

Controlling search engines

Meta Robots

html

<meta name="robots" content="index, follow">

index, follow is what search engines do anyway, so you only need this tag when you want something different:

  • index – allow indexing
  • noindex – don’t index
  • follow – follow links
  • nofollow – don’t follow links

html

<meta name="robots" content="noindex, nofollow">

That page will not appear in search results, and its links will not be followed. Use it for thank-you pages, internal search results and test pages.

Canonical Tag

Canonical tag

html

<link rel="canonical" href="https://example.com/html-meta-tags/">

Technically a link, not a meta, but it lives in the same place. When the same page can be reached at several addresses, it tells search engines which one is the real one.

Social sharing previews

Open Graph Tags (for Social Media)

html

<meta property="og:title" content="Learn Meta Tags for SEO">
<meta property="og:description" content="A beginner-friendly guide to HTML meta tags.">
<meta property="og:image" content="og-image.jpg">
<meta property="og:url" content="https://html5andcss3.org/meta-tags">

When someone shares your link on Facebook, LinkedIn or WhatsApp, these Open Graph tags supply the title, description and image of the preview card. The image should be a full address starting with https://, roughly 1200 by 630 pixels.

Twitter Card Tags

html

<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="HTML Meta Tags for SEO">
<meta name="twitter:description" content="Master meta tags to improve your SEO performance.">
<meta name="twitter:image" content="twitter-image.jpg">

X (Twitter) reads these to decide how the card looks. If they are missing, it falls back to the Open Graph tags.

Tags you can skip

Meta Keywords (Deprecated but Optional)

html

<meta name="keywords" content="HTML, CSS, JavaScript, web development">

Google and Bing ignore this. It does no harm, but it does no good either, and it shows your competitors your keyword list.

Meta Author

html

<meta name="author" content="Your Website or Company Name">

Fine to include, but search engines do not use it for ranking.

Meta Refresh Redirect

html

<meta http-equiv="refresh" content="5; url=https://html5andcss3.org/">

This sends visitors to another page after 5 seconds. It is a poor way to redirect: it is confusing for visitors and slower for search engines. Use a server redirect instead.

Checklist for every page

  • A unique <title> and a unique meta description.
  • charset and viewport.
  • Open Graph title, description and image, if the page will be shared.
  • noindex only on pages you really want kept out of search.
  • No keyword stuffing. Write descriptions for people, not for robots.

Browser Support

Chrome
Edge
Firefox
Safari
Opera
IE9+
YesYesYesYesYesYes

HTML Meta Tags for SEO exercises

Text for the search result

Write a head with the description Learn HTML step by step with short examples.

Result

Check your answer to see it here.