What are meta tags in HTML, and which ones matter?
BeginnerHTML and accessibility interview questionBy UIRound, updated 17 November 2026
Short answer
Meta tags are <meta> elements in the <head> that describe a page to browsers, search engines and link-preview bots rather than to readers. The ones that matter are charset, viewport, description, robots when you need to block indexing, Open Graph and Twitter card tags for share previews, and optionally theme-color. The keywords meta tag is ignored by Google and is not worth adding.
A sensible <head>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Brass desk lamp | Lumen Store</title>
<meta name="description" content="Adjustable brass desk lamp with a warm LED and a two-year warranty. Free delivery in India." />
<link rel="canonical" href="https://example.com/lamps/brass-desk-lamp" />
<meta property="og:type" content="website" />
<meta property="og:title" content="Brass desk lamp" />
<meta property="og:description" content="Adjustable arm, warm LED, two-year warranty." />
<meta property="og:image" content="https://example.com/og/brass-desk-lamp.jpg" />
<meta property="og:url" content="https://example.com/lamps/brass-desk-lamp" />
<meta name="twitter:card" content="summary_large_image" />
<meta name="theme-color" content="#1a1a1a" />
</head><title> and <link rel="canonical"> are not meta tags, but they sit beside them and matter more than most. The title is the clickable headline in search results and the browser tab name.
The tags, one by one
| Tag | What it does | Needed? |
|---|---|---|
charset |
Declares the character encoding | Always, first in <head> |
viewport |
Sets the layout width on phones | Always |
description |
Suggested text for the search snippet | On every indexable page |
robots |
Tells crawlers not to index, follow or snippet a page | Only when you want to restrict something |
Open Graph (og:*) |
Title, description and image for link previews | On any page people might share |
Twitter (twitter:*) |
Card type for X, plus overrides | twitter:card at least |
theme-color |
Colours the browser UI on some mobile browsers | Optional |
http-equiv |
Simulates an HTTP response header | Rarely; prefer real headers |
keywords |
A list of keywords | No, Google ignores it |
charset
<meta charset="utf-8"> tells the browser how to turn bytes into characters. It must appear within the first 1,024 bytes of the document, so put it first. Without it, browsers may guess the encoding and show garbled text, especially for non-Latin scripts and symbols like ₹. A Content-Type: text/html; charset=utf-8 response header does the same job and takes priority.
viewport
Without it, phones lay the page out at a desktop-like width of about 980 CSS pixels and zoom out, so media queries never see a small screen. The details, including why you should not disable zoom, are in What does the meta viewport tag do?.
description
Search engines may show it as the snippet under your title. It is not a ranking factor, but a clear description that matches the query can earn the click. Google often rewrites snippets from page text when it thinks that fits the search better, so treat it as a strong suggestion. Write a unique sentence or two per page that says what the page offers; very long descriptions are cut off in results.
robots
<meta name="robots" content="noindex, nofollow" />noindex keeps a page out of search results; nofollow asks crawlers not to follow its links; values like max-snippet and max-image-preview:large control how results look. The default is "index, follow", so you never need to write that. Two traps: a crawler only sees noindex if it is allowed to fetch the page, so blocking the URL in robots.txt as well can stop the tag from working; and a noindex left over from a staging site can take a whole production site out of search. For PDFs and other non-HTML files, send the same values in an X-Robots-Tag HTTP header.
Open Graph and Twitter cards
When someone pastes your link into WhatsApp, Slack, LinkedIn or X, a bot fetches the page and builds a preview from Open Graph tags. Note they use property, not name. The image needs an absolute URL; a 1200×630 image is the common choice because it works well across platforms.
X reads twitter:card (summary or summary_large_image) to pick the layout and falls back to the Open Graph title, description and image when its own tags are missing, so you rarely need to duplicate them.
These bots generally do not run JavaScript. If your tags are added on the client by a single-page app, previews show nothing useful. They must be in the HTML the server sends, which is one reason server rendering matters for sharing (see How do search engines handle JavaScript and single-page apps?).
theme-color
Colours the address bar or surrounding UI on some mobile browsers and in installed web apps. You can give one per colour scheme:
<meta name="theme-color" content="#ffffff" media="(prefers-color-scheme: light)" />
<meta name="theme-color" content="#111111" media="(prefers-color-scheme: dark)" />http-equiv
http-equiv tags imitate HTTP headers. The one still used is Content-Security-Policy, for sites that cannot set headers, although some directives such as frame-ancestors and reporting do not work from a meta tag. http-equiv="refresh" redirects or reloads after a delay; avoid it, because unexpected reloads are disorienting and an accessibility problem, and a server redirect is better for search engines. X-UA-Compatible was only for old Internet Explorer and can be deleted.
keywords
Google said in 2009 that it does not use the keywords meta tag for ranking, because it was so widely stuffed with spam. Leaving it in does no harm, but it also reveals your target keywords to competitors and wastes bytes.
In Next.js
In the App Router you do not write these tags by hand. Export metadata (or generateMetadata for dynamic pages) from a layout.tsx or page.tsx, and Next.js renders the tags in the server HTML. themeColor lives in a separate viewport export.
import type { Metadata, Viewport } from "next";
export const metadata: Metadata = {
title: "Brass desk lamp",
description: "Adjustable brass desk lamp with a warm LED and a two-year warranty.",
openGraph: {
title: "Brass desk lamp",
description: "Adjustable arm, warm LED, two-year warranty.",
images: ["https://example.com/og/brass-desk-lamp.jpg"],
},
twitter: { card: "summary_large_image" },
};
export const viewport: Viewport = { themeColor: "#1a1a1a" };Practise it
Audit a page's HTML for SEO mistakes checks the title, description and canonical in code. Design a news article page like the New York Times and Design catalogue sharing for resellers are system design questions where share previews are part of the answer.
Common follow-up questions
Do meta tags help SEO?
Indirectly. description affects the snippet and so the click-through rate, and robots controls whether a page is indexed at all. None of them make a page rank higher on their own. The title, the content, links and page experience do that.
What is the difference between name and property?
name and property?name is the standard HTML attribute for metadata like description and robots. Open Graph was defined with property, borrowed from RDFa, so its tags use property="og:title". Twitter tags use name. Most parsers accept either, but follow each spec.
Why does my link preview show an old image?
Platforms cache previews, sometimes for days. Change the image URL (for example add a version to the file name) and use the platform's debugging tool to refetch, if it has one.
Should every page have the same description?
No. Duplicate descriptions are less useful than none, because the search engine will ignore them and build its own snippet. Write one per page, or leave it out on pages you cannot describe well.
Mistakes to avoid
Putting
<meta charset>after other content, or leaving it outShipping
noindexfrom a staging environment to productionAdding Open Graph tags with JavaScript on the client, where bots never see them
Using a relative URL for
og:imageDisabling zoom in the viewport tag
Spending time on
keywordsinstead of a good title and description
Sources
Practise it in code
Interviewers rarely stop at the definition. These questions open in an editor with tests.
- Audit a page's HTML for SEO mistakes: title, meta description, one
<h1>, heading order, imagealt,langand canonicalEasy25 min - Design a news article page like the New York Times: ads without layout shift, a metered paywall, speed, SEO and sharingHard55 min
- Design catalogue sharing for resellers like Meesho: sharing to WhatsApp, deep links, margins and attributionHard50 min