How to generate Open Graph tags: a practical guide for any website

Adding Open Graph tags to a website takes about 5 minutes. You add 6-8 <meta> tags to the <head> of each page. The tags tell social platforms what title, description, and image to use when someone shares the URL. Without them, platforms guess, and the guess is usually wrong.

Platform or focus
Best Practices
OG tag strategy and tooling
Topic detail
OG tag generator
tag-generator

How this is calculated

The minimum viable OG tag set: og:title, og:description, og:image, og:url, og:type (usually 'website' for the homepage, 'article' for content), plus twitter:card set to 'summary_large_image'. In a plain HTML site, add <meta property='og:title' content='...'> to the <head>. In React, use react-helmet-async or the native Helmet component in React Router. In Next.js, use the Metadata API or generateMetadata. In WordPress, Yoast SEO and Rank Math both add OG tags automatically. For the og:image, host a 1200x630 JPEG at a stable URL, preferably on the same domain as the page to avoid cross-origin issues. After adding tags, validate with the Facebook Sharing Debugger.

Verdict

OG tags are the lowest-effort, highest-impact SEO improvement you can make. Five minutes of work makes every link shared from your site look professional instead of broken. Do it now, validate it, and never think about it again.

More OG scenarios

Frequently asked questions

What are Open Graph meta tags?
Open Graph meta tags are snippets of code in your website's <head> that control how your page appears when shared on social media. They allow you to define a specific title, description, and image that platforms like Facebook, Discord, and LinkedIn will display.
Why do I need a separate twitter:card tag?
While many platforms fallback to Open Graph (og:) tags, Twitter uses its own specific meta tags (twitter:card, twitter:image, etc.) to format link previews. Providing both ensures maximum compatibility across all platforms.
What is the best image size for Open Graph?
The recommended size for an Open Graph image is 1200x630 pixels. This creates a 1.91:1 aspect ratio, which is the standard size used by almost all major social platforms for large preview cards.
How do I test if my tags are working live?
Once deployed, you can use official debuggers like the Facebook Sharing Debugger or the Twitter Card Validator. This visualizer tool helps you preview and generate the tags locally before you deploy them.