Skip to main content
wp-config.org

Search tools

Speed and SEO

Open Graph tag generator for X cards and WordPress

Use this Open Graph tag generator to write the og: and X (Twitter) card tags for a page and see how its link will look on Facebook, X, LinkedIn, Slack, Discord, WhatsApp, Messages and in Google as you type. Copy them as HTML for any website, as a snippet for a WordPress child theme, or download a small WordPress plugin. Everything happens in your browser; nothing you type is sent to this site.

  • Live previews
  • HTML, snippet or plugin
  • Runs in your browser

Free, no sign-up. Nothing you type is sent to this site.

This tool needs JavaScript. Turn JavaScript on and reload the page.

Social share preview

Generate Open Graph and X card tags

Fill in what you want people to see when your page is shared, watch the previews change, then copy the code for your site: plain HTML for any website, or a snippet or a ready-made plugin for WordPress. Only the fields you fill in are written. Everything happens in your browser and nothing you type is sent to this site. To measure the image, your browser loads it from the address you type, so the site that hosts it sees that request.

Fixed the tags but the old preview still shows?

  • Facebook: paste the address into Meta’s Sharing Debugger (opens in a new tab) and press Scrape Again. Facebook keeps images by address, so a changed picture needs a new file name.
  • LinkedIn: the Post Inspector (opens in a new tab) shows what LinkedIn reads from the page and when it last read it. You need to be signed in to LinkedIn.
  • X: X’s Card Validator no longer shows previews (opens in a new tab), since August 2022. Paste the link into a new post instead: the card appears without posting. X’s former developer documentation (opens in a new tab) said it reads a page’s card tags again roughly every seven days; X no longer publishes this.
  • Discord: previews are kept for about 30 minutes. To see a change at once, share the address with a new query string, such as ?v=2, or open Discord’s Embed Debugger (opens in a new tab).
  • Slack: Slack keeps a preview for around 30 minutes, then fetches the page again.
  • WhatsApp and Messages: there is no public tool. Paste the link into a message without sending it: WhatsApp shows the preview above the message box within about 10 seconds.
  • WordPress: clear your caching plugin’s or host’s page cache first, or the platforms may fetch the old page.

What you can do

  • Fill in og:, article:, fb:app_id and twitter: tags with help for each

  • Watch eight link previews update as you type

  • See where X, Discord and WhatsApp cut your title and description

  • Copy HTML with every value escaped, for any website

  • Copy a WordPress functions.php snippet or download a plugin

  • Fill the form from a page you checked, to fix what was found

How to make Open Graph tags

  1. Fill in the fields

    Enter the title, description, page address and image address. The image size is measured for you when your browser loads it. Leave out anything you do not need: only filled fields are written.

  2. Check the previews

    The previews show the card on each platform, and the counters say where X, Discord and WhatsApp would cut your text.

  3. Add the code to your site

    Copy the HTML into the page’s <head>, or on WordPress paste the snippet into a child theme’s functions.php or upload the plugin. Then check the page and refresh each platform’s copy.

Adding the tags to your site

The generator writes the same tags three ways. For any website, copy the HTML and paste it inside the page’s <head>. On WordPress, copy the functions.php snippet into a child theme, or download the plugin and upload it under Plugins › Add New Plugin › Upload Plugin. The WordPress code prints the tags on the page you choose only, sets that page’s title through WordPress, replaces WordPress’s own canonical link when you enter one, and escapes every value.

Image guidance

Use a 1200 × 630 px JPEG, PNG or WebP under 600 KB. That is Meta’s recommended size and the 1.91:1 shape Meta and LinkedIn suggest, it meets LinkedIn’s 1200 × 627 px minimum, and it stays under LinkedIn’s 5 MB and WhatsApp’s 600 KB. X no longer publishes image sizes for cards. Keep the important part in the middle, as some apps crop the edges.

After adding the tags

Check the page with the Check a page tab, then make each platform fetch it again: Meta’s Sharing Debugger for Facebook, LinkedIn’s Post Inspector, and a new query string such as ?v=2 for Discord. X’s Card Validator no longer shows previews; paste the link into a new post instead.

Frequently asked questions

Which tags do I need for a good link preview?

og:title, og:description, og:image and og:url cover Facebook, LinkedIn, WhatsApp, Slack, Discord and Messages; LinkedIn lists exactly these four as required. Add og:type, og:image:width, og:image:height and og:image:alt, and twitter:card so X knows which card to show. X takes the title, description and image from the Open Graph tags when there are no twitter: versions.

Why does the generator use property= for og: tags and name= for twitter: tags?

The Open Graph protocol and Meta’s examples write Open Graph tags as <meta property="og:…">, and X’s card markup writes its tags as <meta name="twitter:…">. The generator follows each one’s own documentation.

Do I need fb:app_id?

Only for Facebook Insights: Meta says you must add the app ID to your page to use Insights. It does not change how the link looks, and leaving it out does not stop sharing.

I use Yoast SEO or Rank Math. Should I paste this code?

No. Yoast SEO, Rank Math, SEOPress and All in One SEO already print these tags; set the values in the plugin’s social settings for the post instead. With a second set of tags, each platform picks one of the two. Use the generator’s code only when nothing on your site prints Open Graph tags, which the Check a page tab shows.

Is the WordPress code safe to paste?

Every value is written as a PHP string and printed through WordPress’s own escaping functions, esc_attr(), esc_url() and esc_html(), so quotes or code in what you typed cannot break the page. The code runs only on the page you choose. Paste it into a child theme’s functions.php, or use the plugin download, so a theme update does not remove it.

Is what I type sent anywhere?

Nothing is sent to this site: the generator runs in your browser. To measure your image and show it in the previews, your browser loads it from the address you enter, so the server that hosts it sees that request, as with any image.

Related tools

  • SEO report

    New (added recently)

    Check one page’s SEO basics and PageSpeed, then download the report as a PDF.

  • Generate JSON-LD schema markup for businesses, articles, products, breadcrumbs and FAQs.

  • Favicon generator

    New (added recently)

    Make favicon.ico, Apple and Android icons and a web app manifest from your logo or a letter, in your browser.

  • Website speed test

    New (added recently)

    Test a page’s speed on mobile and desktop with Google PageSpeed Insights, plus accessibility, best practices and SEO scores, a waterfall and WordPress fixes.