← Back to blog
Social Sharing

Open Graph Tags: The 6 You Need, the Sizes That Work, and How to Debug Previews

The protocol requires four tags and the platforms read two more. Image rules differ by app, and most broken previews turn out to be caching problems, not bad markup.

By Rajhussain Kanani6 min read

The short answer

Open Graph tags are <meta property="og:..."> tags in a page's <head> that tell Facebook, LinkedIn, WhatsApp, Slack, iMessage and other apps which title, description and image to show when someone shares the link. The protocol requires four of them: og:title, og:type, og:image and og:url. Add og:description as well, because LinkedIn and WhatsApp expect it. Use an image around 1200 × 630 px (1.91:1), under 600 KB, at an absolute https:// URL, and make sure the tags are in the HTML your server sends, not added later by JavaScript. If a preview is still wrong after that, the cause is usually a cache, not your markup.

The smallest tag set that works

These four lines are the whole requirement of the Open Graph protocol at ogp.me. Everything else improves the result or satisfies one particular platform.

<meta property="og:title" content="Trail Runner X2 Review">
<meta property="og:type" content="article">
<meta property="og:image" content="https://trailfoot.example.com/og/trail-runner-x2.jpg">
<meta property="og:url" content="https://trailfoot.example.com/reviews/trail-runner-x2">

Without any Open Graph tags, Facebook's crawler guesses the title, description and image from the page, and the guess is often a logo or an ad. Writing the tags yourself removes the guesswork.

The full tag set, and what each tag does

On top of the four required tags, the platforms ask for a few more. LinkedIn's help center lists og:title, og:image, og:description and og:url as tags that must exist, and WhatsApp's documentation says title, description and URL must be in the head and not empty.

1

og:title

The headline of the card. Facebook, Apple and WhatsApp each say to leave the site name and other branding out of it and use og:site_name for that. Google also lists og:title among the sources it may use when it writes a title link in search results, so keep it accurate and close to the page's real title.

2

og:description

The summary under the title. Facebook describes it as two to four sentences. WhatsApp shows one or two lines and says 80 characters will suffice, and X's mobile apps don't show the description on large image cards at all, so put the point in the first few words.

3

og:image (plus width, height and alt)

The absolute URL of the preview image. Add og:image:width and og:image:height: Facebook says they let the crawler render the image immediately instead of downloading and processing it in the background, which matters for the first share. ogp.me says a page with og:image should also have og:image:alt, a description of what the image shows.

4

og:url

The canonical URL of the page, with no session variables, tracking parameters or counters. Facebook aggregates likes and shares at this URL, so it should match your rel="canonical". An og:url that points at your homepage on every page tells Facebook that all your articles are the same object.

5

og:type

website for most pages, article for posts and news. ogp.me says a page without the markup is treated as website. Facebook notes that the type affects how content appears in Feed. The article type allows extra properties such as article:published_time.

6

og:site_name

The name of the overall site. Apple points to it as the place for branding instead of the title, and Google considers it when choosing the site name shown in search results, though it says WebSite structured data matters more.

How to add Open Graph meta tags so crawlers see them

Use property=, not name=. The protocol is built on RDFa and every example on ogp.me uses property. Put the tags near the top of the <head>: Meta's crawler cuts off Open Graph properties that come after the first 1 MB, and WhatsApp needs the head within the first 300 KB of HTML. Most important, render them on the server. Apple states that Messages link previews do not run JavaScript or follow meta redirects, and Slack says its crawler fetches as little of the page as it can to read the tags. Tags injected in the browser by a single-page app or a tag manager are invisible to these crawlers.

<head>
  <title>Trail Runner X2 Review | TrailFoot</title>
  <link rel="canonical" href="https://trailfoot.example.com/reviews/trail-runner-x2">

  <meta property="og:title" content="Trail Runner X2 Review">
  <meta property="og:description" content="Grip, fit and comfort after a season on muddy trails.">
  <meta property="og:image" content="https://trailfoot.example.com/og/trail-runner-x2.jpg">
  <meta property="og:image:width" content="1200">
  <meta property="og:image:height" content="630">
  <meta property="og:image:alt" content="Muddy trail running shoe on a rocky path">
  <meta property="og:url" content="https://trailfoot.example.com/reviews/trail-runner-x2">
  <meta property="og:type" content="article">
  <meta property="og:site_name" content="TrailFoot">

  <meta name="twitter:card" content="summary_large_image">
</head>

The last line is for X. According to X's card markup reference, twitter:title, twitter:description, twitter:image and twitter:image:alt fall back to the matching og: tags. The card type does not: if twitter:card is missing, X may render a small summary card instead of the large image one. The Twitter card validator guide covers that gap in detail.

Next.js App Router. Set the same values through openGraph in your metadata. Relative image and URL paths need metadataBase; without it the build fails. Metadata from nested segments is merged shallowly, so a page's own openGraph object replaces the layout's rather than extending it, and an openGraph without images loses the layout's image. Next.js also streams metadata for ordinary browsers but keeps it in the head for bots such as Twitterbot and Slackbot, so test with a crawler user agent rather than your browser.

// app/reviews/trail-runner-x2/page.tsx
import type { Metadata } from "next";

export const metadata: Metadata = {
  // Usually set once in app/layout.tsx
  metadataBase: new URL("https://trailfoot.example.com"),
  alternates: { canonical: "/reviews/trail-runner-x2" },
  openGraph: {
    title: "Trail Runner X2 Review",
    description: "Grip, fit and comfort after a season on muddy trails.",
    url: "/reviews/trail-runner-x2",
    siteName: "TrailFoot",
    type: "article",
    images: [
      {
        url: "/og/trail-runner-x2.jpg",
        width: 1200,
        height: 630,
        alt: "Muddy trail running shoe on a rocky path",
      },
    ],
  },
};

What each platform reads

PlatformReadsImage guidanceRefresh
FacebookOpen Graph tags; guesses from the page if they are missingAt least 200 × 200 px and under 8 MB; 1200 × 630 recommended, 600 × 315 minimum for a large cardSharing Debugger; caches refresh on their own about every 24 hours
LinkedInog:title, og:image, og:description, og:urlAt least 1200 × 627 px, under 5 MB, 1.91:1; images under 401 px wide show as a thumbnailPost Inspector
Xtwitter: tags first, then og: tags; needs twitter:card for the large card2:1 ratio, 300 × 157 to 4096 × 4096 px, under 5 MB, no SVGNo documented tool; share with a new image URL
WhatsAppog:title, og:description, og:url, og:imageUnder 600 KB, at least 300 px wide, width-to-height ratio of 4:1 or lessNo documented tool
SlackoEmbed, Twitter Card and Open Graph tagsNo published size rulesCache lasts about 30 minutes
iMessageOpen Graph tags (og:title, og:image, og:site_name)At least 900 px wide; under 150 px may be ignored or shown as an iconNo documented tool

Image rules that cover every platform

  • Size and ratio: 1200 × 630 px (1.91:1) meets Facebook's high-resolution recommendation, LinkedIn's 1200 × 627 minimum and Apple's 900 px guidance. X's large card is 2:1, so it can crop a 1.91:1 image slightly. Keep important content away from the top and bottom edges.
  • File weight: keep it under 600 KB. That is WhatsApp's limit and the one people miss. Photos exported as JPG usually fit, while the same picture as PNG often does not.
  • URL: absolute, on HTTPS, and publicly reachable without a login, hotlink protection or an expiring signed URL. WhatsApp requires an absolute image URL, and ogp.me defines URL values as full addresses.
  • Format: JPG, PNG or GIF for Facebook (og:image:type), WEBP also works on X, and SVG does not work on X.
  • Text in the image: Apple advises against it, because images are shown at different sizes and the text can become unreadable. Put the words in the title and description tags.

Paste a URL into CheckSEO's Open Graph Checker to see which og: tags the page has, which are missing, and a share-card preview built from those values. No signup.

Check your Open Graph tags

Why your link preview is stale, and how to refresh it

Platforms fetch a URL, cache what they find and reuse it. Facebook caches images by their URL, so overwriting the file at the same address changes nothing. Meta's guidance is to give the new image a new URL and keep the old file, since earlier shares still point to it. How to force a fresh fetch:

  • Facebook: paste the page URL into the Sharing Debugger. It shows the tags the crawler read with any errors or warnings, and it triggers a new scrape. If an image will not render, paste the image URL itself into the debugger too. Meta says its cache otherwise refreshes about every 24 hours.
  • LinkedIn: run the URL through Post Inspector, which shows what LinkedIn extracted, when it last updated its data, and lets you request a re-scrape.
  • Slack: caches unfurls across the service for around 30 minutes, so waiting is enough.
  • WhatsApp and iMessage: the official documentation describes no refresh tool. The practical route is a URL they have not seen: give the image a new filename, or share the page with a harmless query string added.

Updating an image does not change posts that are already out. Meta says old shares need to be refreshed separately. Check the tags before a link goes out widely, not after.

Open Graph debugging checklist

1

The tags are in the raw HTML

Use view-source, or fetch the page the way Meta's crawler does: curl -s -A "facebookexternalhit/1.1" https://yourdomain.com/page, then search for og:. Don't trust the Elements panel in DevTools, which shows the page after JavaScript has run.

2

The image URL returns a real image

Open the og:image URL in a private window. It should return status 200 with an image/jpeg or image/png content type over HTTPS, with no login or expiring link.

3

Size, ratio and weight are right

Around 1200 × 630, under 600 KB, and the og:image:width and og:image:height values match the actual file.

4

Crawlers aren't blocked

Check robots.txt and any firewall or bot protection for rules that catch facebookexternalhit, LinkedInBot, WhatsApp or Twitterbot. Meta asks sites to allowlist its crawler by user agent or IP address and to respond within a few seconds, and says the server must support gzip and deflate encoding. Slack does not honor robots.txt, so a working Slack preview proves nothing about Facebook.

5

Redirects resolve on the server

Apple follows server-side redirects but not meta refresh or JavaScript redirects. Make sure the page you land on carries the tags and an og:url pointing to itself.

6

No relative URLs

content="/og.jpg" fails on platforms that need an absolute URL. Use the full https:// address.

7

No duplicate tags

When a theme and an SEO plugin both print og:image, ogp.me says the first tag from top to bottom wins. Remove one source. The meta tags guide covers the rest of the head.

8

Mobile and desktop get the same tags

Apple asks sites to serve the same metadata to every user agent. A page that changes its head depending on the user agent often breaks one platform's preview.

Check your Open Graph tags

CheckSEO's Open Graph Checker fetches a URL and reports whether og:title, og:description, og:image, og:url and og:type are present, flags a missing og:site_name or og:locale, warns when og:image isn't an absolute URL, and draws a share-card preview from the values it finds. Run it after every fix, then refresh the platform caches.

Sources

Frequently asked questions

What are Open Graph tags?

Open Graph tags are meta tags in a page's head, written with a property attribute such as og:title, that tell Facebook, LinkedIn, WhatsApp, Slack, iMessage and other apps which title, description, image and URL to show when the link is shared. The protocol requires og:title, og:type, og:image and og:url.

What size should an og:image be?

Use 1200 × 630 pixels (1.91:1), saved as a JPG or PNG under 600 KB. That meets Facebook's recommended size, LinkedIn's 1200 × 627 minimum and 5 MB cap, X's 5 MB limit and WhatsApp's 600 KB limit. Add og:image:width, og:image:height and og:image:alt, and use an absolute https URL.

How do I check my Open Graph tags?

View the page source, or fetch the page with curl using a crawler user agent, and confirm the og: tags are in the head of the HTML the server returns. Then use an Open Graph checker for a preview, and Facebook's Sharing Debugger or LinkedIn's Post Inspector to see what those platforms scraped.

Why does my link still show the old preview?

Platforms cache what they scraped. Run the URL through Facebook's Sharing Debugger and click Scrape Again, or through LinkedIn's Post Inspector. Slack's cache clears in about 30 minutes. WhatsApp, iMessage and Discord have no public refresh tool, so rename the image file or add a version query string. Posts already published usually keep the old card.

Do I need Twitter Card tags if I have Open Graph tags?

Only one is essential. X falls back to og:title, og:description, og:image and og:image:alt when the twitter: versions are missing, but nothing replaces twitter:card. Without a twitter:card tag set to summary_large_image, X may fall back to a small summary card instead of the large image card.

Check your own site with the Open Graph Checker.

Open Open Graph Checker

Want every check at once?

The free Full Audit runs 33 checks on any URL, most of them in seconds. Add your email afterwards and we send a detailed one-page report; the full-site report covers up to 1,000 pages.

More from the blog

We use cookies to analyze site usage and improve your experience. You can decline non-essential cookies. Privacy Policy