Meta Tag Generator

Title, description, Open Graph and Twitter card tags, with previews.

About Meta Tag Generator

A meta tag generator that turns a title, description, URL and image into the HTML head tags for search engines, Open Graph and Twitter cards.

How to use

  1. Enter the page title and description. The counters show their length against the usual guides of about 60 and 160 characters.
  2. Add the canonical URL, a robots setting, an image URL, the site name and a Twitter or X handle. Any of these can be left blank.
  3. Copy or download the snippet and paste it inside the <head> of the page. The two previews give a rough idea of a search result and a shared link.

What it does

  • Writes <title>, the description, <link rel="canonical"> and the robots tag, then the og: tags for Open Graph and the twitter: tags for the card.
  • Escapes &, <, > and double quotes, so a title such as Tom & Jerry's "Best" cannot break the markup.
  • Folds line breaks in the description into single spaces, and leaves out the tag for any blank field.
  • Uses the summary_large_image card when there is an image and summary when there is not.
  • Accepts a handle as name, @name or a profile link, and writes it as @name.
  • Checks that the canonical and image URLs are absolute http or https addresses, and leaves them out until they are.
  • Does not fetch the image or the page, so it cannot confirm that the image exists or is the right size. The previews are approximations: each search engine and network chooses its own layout, and may replace your description.

Example

Title:        Blue Widgets | Acme
Description:  Hand-built widgets, shipped in two days.
Canonical:    https://example.com/widgets

<title>Blue Widgets | Acme</title>
<meta name="description" content="Hand-built widgets, shipped in two days.">
<link rel="canonical" href="https://example.com/widgets">
<meta name="robots" content="index, follow">

<meta property="og:type" content="website">
<meta property="og:title" content="Blue Widgets | Acme">
<meta property="og:description" content="Hand-built widgets, shipped in two days.">
<meta property="og:url" content="https://example.com/widgets">

<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Blue Widgets | Acme">
<meta name="twitter:description" content="Hand-built widgets, shipped in two days.">

Privacy

The tags are built in the browser from what you type. No request is made: the page and the image are never fetched, and nothing is stored.

Frequently asked questions

What meta tags does a page need for SEO?
A title, a meta description and a canonical link cover search results. Open Graph tags (og:title, og:description, og:image, og:url) control how the link looks when shared, and twitter:card selects the card style on X. A robots tag is only needed to keep a page out of the index.
How long should a meta title and description be?
About 60 characters for the title and about 160 for the description. Search engines cut by pixel width, not by character count, so these are guides: shorter text is usually shown in full, and longer text is likely to end in an ellipsis.
What size should an Open Graph image be?
1200 × 630 pixels, a ratio of 1.91:1, suits the large card on most networks. Give it as an absolute https URL: the Open Graph protocol expects a full address, and not every crawler resolves a relative one.
Do I need both Open Graph and Twitter tags?
X falls back to og:title, og:description and og:image when the twitter: versions are missing, so the Open Graph set is the one to have. The twitter:card tag is still worth adding, because it chooses between the small summary card and the large image card.