Skip to content
All articles

Blog

Open Graph tags: how to fix link previews on Facebook, LinkedIn and X

What Open Graph and X card tags are, the exact tags every page needs, the right og:image size, and how to fix a link preview that shows the wrong picture or none at all.

Last updated

Open Graph tags are meta tags in a page's <head> that tell Facebook, LinkedIn, WhatsApp, Slack, Discord and most other apps which title, description and image to show when someone shares the link. X reads its own twitter: tags first and falls back to Open Graph. Get them right once in your page template and every share of every page looks the way you want.

To see what your page shows today, paste it into the free Open Graph checker. It draws the preview for Facebook, LinkedIn, WhatsApp and X, checks each tag and downloads the start of the share image to make sure it loads.

The tags every page needs

<meta property="og:title" content="How to fix link previews" />
<meta property="og:description" content="One sentence that makes people want to click." />
<meta property="og:image" content="https://example.com/images/link-previews.png" />
<meta property="og:image:width" content="1200" />
<meta property="og:image:height" content="630" />
<meta property="og:image:alt" content="A shared link with a large picture" />
<meta property="og:url" content="https://example.com/blog/link-previews" />
<meta property="og:type" content="article" />
<meta property="og:site_name" content="Example" />
<meta name="twitter:card" content="summary_large_image" />
  • og:title: the headline of the card. It can differ from your title tag; write it for people scrolling a feed. Apps cut it after about 60 to 90 characters.
  • og:description: one or two sentences. Previews show about 110 to 160 characters, so lead with the point. Some apps, like X with a large card, don't show it at all.
  • og:image: the picture. It must be a full address starting with https://. A relative path like /images/share.png works in a browser but not in most apps.
  • og:image:width and og:image:height: let Facebook draw the picture the first time the link is shared, before it has downloaded the image.
  • og:image:alt: a short description of the picture for screen reader users.
  • og:url: the page's canonical address, so shares and likes count for one URL rather than every version with tracking parameters.
  • og:type: "website" for the homepage and main pages, "article" for posts.
  • og:site_name: your brand name, shown above or below the title in several apps.
  • twitter:card: "summary_large_image" gives a full-width picture on X. Without it, X shows a small square or a plain link.

The right og:image size

Use 1200 x 630 pixels. That 1.91:1 shape fills the large card on Facebook, LinkedIn and X without cropping much. Smaller than 600 x 315 and most apps fall back to a small thumbnail.

  • Keep text and logos in the middle; some apps crop the edges, and WhatsApp shows a small square on some phones.
  • Use PNG or JPEG. Keep the file under 1 MB so it loads fast on mobile; X refuses images over 5 MB.
  • Give each important page its own image. One image for the whole site works, but posts with a picture that matches the topic get more clicks.

Why a preview shows no image, or the wrong one

  1. No og:image at all. Many themes only add one to the homepage. Check a blog post and a product page, not just the homepage.
  2. A relative image address. Change /images/share.png to https://example.com/images/share.png.
  3. The image doesn't load for bots. A firewall, hotlink protection or a login wall can return an error to the app's crawler while it works in your browser. The checker fetches the image from outside and shows the HTTP status.
  4. The image is too big or the wrong type. An 8 MB photo or a WebP file can fail in some apps. Export a 1200 x 630 PNG or JPEG.
  5. The page itself is blocked. If robots.txt, a cookie wall or a JavaScript-only page hides the <head>, apps see no tags. Tags must be in the HTML the server sends, not added later by JavaScript.
  6. An old preview is cached. Apps keep a copy for days. After fixing the tags, use Facebook's Sharing Debugger (Scrape Again) and LinkedIn's Post Inspector to refresh it.

How to add Open Graph tags

  • WordPress: SEO plugins such as Yoast SEO, Rank Math and All in One SEO add them. Set a default share image in the plugin's social settings, then a custom one per post where it matters.
  • Shopify: most themes add them from the product image and description. Set a social sharing image under Online Store, Preferences for pages without one.
  • Next.js: use the openGraph and twitter fields of the metadata export, or an opengraph-image file next to the page.
  • Hand-written HTML: paste the block above into the <head> of each page and change the values.

Do Open Graph tags help SEO?

Not directly. Google ranks pages by their content and links, not by og: tags. But a link with a clear title and a good picture gets clicked and re-shared more, and those visits and mentions are part of how a site grows. Several AI assistants also read og:title and og:description as a quick summary of a page. While you're in the <head>, check your title tag and meta description and your structured data too, because those do affect how you appear in Google.

One page at a time is fine for a small site. To check titles, descriptions, images and structured data on every page at once, add your site to Sonnetpilot: a free 25-page audit starts as soon as you add it, with a list of fixes you approve.

Frequently asked questions

What Open Graph tags does every page need?

og:title, og:description, og:image (a full https:// URL), og:url, og:type and og:site_name, plus og:image:width, og:image:height and og:image:alt. For X, add twitter:card with the value summary_large_image.

What is the best og:image size?

1200 x 630 pixels, a ratio of about 1.91:1. Keep important text away from the edges, keep the file under 1 MB if you can, and never over 5 MB.

Why is my link preview not showing an image?

The usual causes are a missing og:image, a relative image address instead of a full https:// URL, an image that returns an error or is blocked for bots, a file that is too large, or an old preview still in the app's cache.

How do I make Facebook or LinkedIn show the new preview?

Fix the tags, then ask the app to read the page again: Facebook's Sharing Debugger has a Scrape Again button and LinkedIn's Post Inspector re-reads the page when you inspect it. Other apps refresh their cache on their own.

Do Open Graph tags affect Google rankings?

No, Google doesn't use them to rank pages. They control how your link looks when shared, which changes how many people click it from social posts and chats.

Bring your website. We'll show you what to fix first.

Type your website and see its SEO, AEO and GEO scores in 10 seconds, no account needed. Then get a free audit of up to 25 pages. No credit card required.