What you'll learn
- Quick answer
- What Are HTML Meta Tags?
- charset: Get the Text Encoding Right
- viewport: Make Pages Mobile-Friendly
- description: Your Search Result Snippet
- Open Graph and Twitter Cards: Social Previews
- robots: Control What Gets Indexed
- canonical: Avoid Duplicate-Content Confusion
- A Copy-Paste head Starter Template
- FAQ
Quick Answer
HTML meta tags are small lines of code in your page's <head> that tell browsers and search engines how to read and show your page. The must-haves are charset (text encoding), viewport (mobile layout), and description (your search snippet). Add Open Graph and Twitter tags for good-looking social previews, plus robots and canonical to control indexing and duplicate URLs. None of them appear on the visible page, but they quietly shape how your site behaves everywhere.
What Are HTML Meta Tags?
HTML meta tags are short instructions you place inside the <head> of a page. Visitors never see them on screen, but browsers, search engines like Google, and social apps like WhatsApp and LinkedIn all read them to decide how to treat your page.
Think of them as labels on a parcel. The parcel is your content; the labels say what language it is in, how to display it on a phone, and what preview to show when someone shares it. Get the labels right and everything downstream works smoothly. Get them wrong and your page might look broken on mobile or show an ugly link when shared.
Most meta tags follow one of two shapes:
<meta name="description" content="...">
<meta charset="UTF-8">In this guide we will walk through the html meta tags that actually matter for SEO and sharing, with copy-paste snippets for each. If you are still learning the basics of the language, our free HTML course covers page structure from the ground up.
charset: Get the Text Encoding Right
The charset tag tells the browser which character encoding your page uses. In plain terms, it decides whether symbols, accented letters, rupee signs, and emoji show up correctly, or turn into garbled boxes like ₹.
<meta charset="UTF-8">Always use UTF-8. It covers almost every language and symbol you will ever need, including Hindi, Tamil, Bengali, and the ₹ sign.
The one gotcha
This tag must be one of the very first things inside <head>, ideally within the first 1024 bytes. If the browser starts reading text before it knows the encoding, it may guess wrong and have to reload. So put charset at the top, above the title and everything else.
viewport: Make Pages Mobile-Friendly
Most of your visitors in India are on phones. The viewport tag tells mobile browsers to size the page to the device's screen instead of pretending to be a wide desktop and zooming out.
<meta name="viewport" content="width=device-width, initial-scale=1.0">Here is what the two parts do:
width=device-widthmatches the layout width to the phone's actual width.initial-scale=1.0sets the starting zoom to 100 percent, so nothing looks shrunk.
Without this tag, a responsive CSS layout simply will not work on mobile. Google also uses mobile-friendliness as a ranking signal, so this small line has a real SEO impact.
Recommendation: Use the exact snippet above and leave it alone. Avoid
maximum-scale=1.0oruser-scalable=no, because they stop people from pinch-zooming, which hurts accessibility.
description: Your Search Result Snippet
The description tag is the summary Google often shows under your page title in search results. A clear, honest description earns more clicks, even though it is not a direct ranking factor.
<meta name="description" content="Learn HTML from scratch with free, beginner-friendly lessons and hands-on projects. Build real web pages step by step.">How to write a good one
- Aim for roughly 120 to 160 characters. Longer text gets cut off with an ellipsis.
- Write for a human, not a keyword-stuffing robot. Describe what the page actually offers.
- Give every page its own description. Duplicate descriptions across pages waste the chance to stand out.
One honest note: Google sometimes ignores your description and generates its own snippet from the page content if it thinks that fits the search better. That is normal. Write a good description anyway, because it is your best shot at controlling the message.
Open Graph and Twitter Cards: Social Previews
When someone shares your link on WhatsApp, LinkedIn, Facebook, or X, those apps look for special meta tags to build a preview card with a title, description, and image. Without them, you get a bare, unappealing link.
Open Graph (used by most apps)
<meta property="og:title" content="HTML Meta Tags Explained">
<meta property="og:description" content="A beginner-friendly guide to the meta tags that matter.">
<meta property="og:image" content="https://priodemy.com/images/meta-tags.png">
<meta property="og:url" content="https://priodemy.com/blog/html-meta-tags">
<meta property="og:type" content="article">Twitter (X) Cards
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="HTML Meta Tags Explained">
<meta name="twitter:description" content="A beginner-friendly guide to the meta tags that matter.">
<meta name="twitter:image" content="https://priodemy.com/images/meta-tags.png">Notice that Open Graph uses property= while Twitter uses name=. That difference is easy to miss and is a common cause of broken cards.
Gotchas worth knowing
- Use an absolute URL for images (starting with
https://), not a relative path like/img.png. Relative paths usually fail. - A good image size is around 1200 x 630 pixels. Too small and it may not fill the card.
- If you set the Twitter tags, X will use them; if you skip them, X falls back to your Open Graph tags. So at minimum, always set Open Graph.
robots: Control What Gets Indexed
The robots meta tag tells search engines whether they may show a page in results and follow its links. By default, pages are indexable, so you only need this tag when you want to change that behaviour.
<meta name="robots" content="index, follow">The useful values are:
noindexkeeps the page out of search results. Perfect for thank-you pages, admin screens, or thin duplicate pages.nofollowtells engines not to pass ranking credit through the page's links.- You can combine them:
content="noindex, nofollow".
A common, costly mix-up
Do not confuse the robots meta tag with the robots.txt file. If you block a page in robots.txt, Google cannot crawl it, which means it will never read a noindex tag inside that page. To reliably remove a page from search, allow crawling and use noindex in the meta tag, not a robots.txt block.
canonical: Avoid Duplicate-Content Confusion
Technically a <link>, not a <meta> tag, but it lives in the same <head> and matters just as much for SEO. The canonical tag tells search engines which URL is the real, preferred version of a page.
<link rel="canonical" href="https://priodemy.com/courses/html">Why does this matter? The same content is often reachable through several URLs, for example:
https://priodemy.com/courses/htmlhttps://priodemy.com/courses/html?ref=newsletterhttps://www.priodemy.com/courses/html
Left alone, search engines may treat these as separate pages and split your ranking strength across them. A canonical tag points them all to one address, so all the credit lands in one place.
Recommendation: On every page, add a self-referencing canonical pointing to that page's clean, preferred URL. Always use the full absolute URL.
A Copy-Paste head Starter Template
Here is a complete, working <head> that combines everything above. Change the text and URLs to match your page, and you have a solid SEO and sharing setup.
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HTML Meta Tags Explained | Priodemy</title>
<meta name="description" content="A beginner-friendly guide to the essential HTML meta tags for SEO.">
<link rel="canonical" href="https://priodemy.com/blog/html-meta-tags">
<meta name="robots" content="index, follow">
<!-- Open Graph -->
<meta property="og:title" content="HTML Meta Tags Explained">
<meta property="og:description" content="A beginner-friendly guide to the essential meta tags.">
<meta property="og:image" content="https://priodemy.com/images/meta-tags.png">
<meta property="og:url" content="https://priodemy.com/blog/html-meta-tags">
<meta property="og:type" content="article">
<!-- Twitter -->
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="HTML Meta Tags Explained">
<meta name="twitter:description" content="A beginner-friendly guide to the essential meta tags.">
<meta name="twitter:image" content="https://priodemy.com/images/meta-tags.png">
</head>Start with the top three lines on every project, then layer in social and canonical tags as your site grows. Once you are comfortable here, the next step is styling that page, which our free HTML course and CSS lessons walk you through with hands-on practice.
Frequently Asked Questions
Do meta tags actually improve my Google ranking?
Some do indirectly, and some are neutral. The viewport tag supports mobile-friendliness, which is a ranking factor, and canonical tags prevent duplicate-content problems. The description tag is not a ranking factor, but a good one earns more clicks. Meta keywords, an old tag, are ignored by Google entirely, so skip them.
Where exactly do meta tags go in my HTML?
All of them go inside the <head> element, before the <body>. Put the charset tag first, ideally right after the opening <head> tag, because the browser needs to know the encoding before it reads any other text.
What is the difference between Open Graph and Twitter Card tags?
Both build link-preview cards, but for different platforms. Open Graph tags (using property="og:...") are read by WhatsApp, LinkedIn, Facebook, and many others. Twitter Card tags (using name="twitter:...") are read by X. If you only set Open Graph, X will fall back to it, so at minimum always include Open Graph tags.
Why is my shared link showing no image or the wrong preview?
The usual causes are a relative image URL instead of an absolute one, a missing og:image tag, or the platform caching an old version. Use a full https:// image URL around 1200 x 630 pixels, then re-share. Platforms like Facebook and LinkedIn also offer debugging tools that let you refresh the cached preview.
How do I stop a page from appearing in Google search?
Add <meta name="robots" content="noindex"> to that page's <head> and make sure the page is still crawlable. Do not block it in robots.txt, because then Google cannot read the noindex instruction and the page may linger in results.
Is the canonical tag a meta tag?
Not technically. It is a <link rel="canonical"> element, not a <meta> element. But it lives in the same <head> section and plays a similar behind-the-scenes SEO role, so it is almost always covered alongside meta tags.
