How to generate Open Graph tags for any website
By TechCompare · Updated · How we check
Adding OG tags takes about five minutes and gives every shared link a title, description, and image instead of a platform's guess. Add them, then validate with the Facebook Sharing Debugger.
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.
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'.
How you add them depends on your stack:
- 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
Add six to eight meta tags to the head: og:title, og:description, og:image, og:url, og:type, plus twitter:card on summary_large_image. Plain HTML takes them directly in the head, React uses react-helmet-async or React Router Helmet, Next.js has the Metadata API or generateMetadata, and WordPress gets them from Yoast SEO or Rank Math. Host the 1200x630 JPEG on the same domain to sidestep cross-origin issues.
More OG scenarios
Related guides
Frequently asked questions
What are the minimum Open Graph tags every page needs?
How do I add OG tags in React or Next.js?
Do I need an SEO plugin for OG tags in WordPress?
Related tools
JSON Formatter
Validate, format, and minify JSON. Browse it as a tree, run JSONPath queries, compare two documents, or validate against a JSON Schema.
Use toolRobots.txt Tester
Test which crawlers a site's robots.txt allows for a page, from Googlebot and Bingbot to GPTBot and ClaudeBot, then check its sitemaps and redirects.
Use toolColor Picker
Pick colors, convert between HEX, RGB, HSL, HSV, OKLCH and CMYK, and find the nearest CSS and Tailwind color.
Use tool