Open Graph tags decide how your pages look when they are shared on social networks and in messaging apps. Most site owners know about og:title and og:image, but the protocol has many more properties: image dimensions, content types, locales and article dates. Some are worth adding; others make little difference.
This guide is a practical reference. It explains where Open Graph came from, which tags the specification requires, what the optional ones do, and how to generate a complete, correct set for any page.
Where Open Graph comes from
The Open Graph protocol was introduced by Facebook in 2010 so that any web page could become a rich object when shared. The specification lives at ogp.me. Since then, LinkedIn, Pinterest, Slack, Discord, WhatsApp, Telegram and many other apps have adopted it, which is why one set of tags covers most platforms.
The tags are ordinary <meta> elements in the page head, using the property attribute:
<meta property="og:title" content="A Beginner's Guide to Composting on a Balcony">
The four required properties
The specification lists four properties that every page should have:
| Tag | Purpose | Example |
|---|---|---|
og:title |
Title of the object as it should appear | A Beginner's Guide to Composting on a Balcony |
og:type |
What kind of object it is | article, website, product |
og:image |
Image URL representing the object | https://www.example.com/img/compost-1200x630.jpg |
og:url |
Canonical URL of the object | https://www.example.com/garden/balcony-composting |
In practice, og:description is just as important, because most cards display it.
Useful optional properties
Site name and description
og:site_name is the name of the overall site ("Example Gardens"). og:description is one or two sentences summarising the page.
Image details
| Tag | Why add it |
|---|---|
og:image:width / og:image:height |
Lets platforms lay out the card before downloading the image, which can help the very first share render correctly |
og:image:type |
The MIME type, such as image/jpeg or image/png |
og:image:alt |
A text description for people using screen readers |
og:image:secure_url |
An https version of the image, for older consumers that look for it |
A widely used image size is 1200 × 630 pixels, a 1.91:1 ratio. Images below about 600 × 315 may be shown as small thumbnails on some platforms. Platform requirements change, so check current guidance if you target one network in particular.
Locale
og:locale states the language and territory, written with an underscore: en_GB, en_US, fr_FR. Additional languages the page is available in go in og:locale:alternate. Note the difference from hreflang, which uses a hyphen (en-GB).
og:type values
website is the default for general pages. article is for blog posts and news. Other types in the specification include profile, book, video.movie, video.episode and music.song. Some platforms define extra types of their own, such as product types.
Article properties
When og:type is article, you can add:
article:published_timeandarticle:modified_timein ISO 8601 formatarticle:author- a profile URLarticle:section- a high-level category, such as "Gardening"article:tag- one tag per keyword, repeated as needed
Generate tags with our tool
The Open Graph Generator builds the full set, including matching X tags.
- Open the Open Graph Generator and choose og:type: website, article, product, profile, book, video.movie, video.episode or music.song.
- Enter og:site_name, og:title and og:description. Badges compare lengths with about 60 and 160 characters.
- Enter og:url (canonical) as a full URL.
- Set og:locale (for example
en_GB) and any og:locale:alternate (comma separated) values. - In the Image section, enter the og:image URL, Width, Height, MIME type and og:image:alt. An
og:image:secure_urltag is added automatically for https images. - For articles, the Article section appears: set Published time, Modified time, article:author (profile URL), article:section and article:tag (comma separated). Times are converted from your local time zone to UTC.
- Under Twitter / X, keep Include Twitter tags on to add a
twitter:card(summary_large_image or summary), twitter:site and twitter:creator. Add fb:app_id only if you use Facebook's app features. - Check the Checks for missing title or image, relative URLs, small images, an unusual aspect ratio and a badly formatted locale, then view the Facebook preview.
- Copy or Download the tags from the Meta tags output panel and paste them inside the page's
<head>.
Other ways to add Open Graph tags
SEO plugins and CMS settings. Most platforms add Open Graph tags automatically from the page title, excerpt and featured image. Check them in the page source; defaults often use a small or wrongly cropped image.
Framework metadata APIs. Modern web frameworks have built-in ways to declare metadata per page, which render tags on the server. This is the most maintainable option for custom sites.
Hand-written tags. For a handful of static pages, writing tags by hand is fine. Use a generator the first time to get the full set.
Pitfalls to avoid
- Relative URLs.
og:urlandog:imagemust be absolute. - Tags added only in the browser. Many preview crawlers do not run JavaScript.
- Different titles everywhere. The page title,
og:titleand heading can differ in wording, but they should describe the same thing. - Wrong locale format.
en-USis hreflang style; Open Graph usesen_US.
Check the finished tags across platforms with the Open Graph Preview and the Twitter Card Preview. For search-engine structured data about the same article, use the Article Schema Generator.
Frequently asked questions
Which Open Graph tags are required?
The specification requires og:title, og:type, og:image and og:url. Adding og:description is strongly recommended because most cards display it.
What is the best og:image size?
1200 × 630 pixels (1.91:1) is the most common recommendation and works well across major platforms.
Do Open Graph tags help search rankings?
No. They control how links look on social networks and apps. They are separate from search engine structured data.
Should I add og:image:width and height?
It is recommended. Dimensions let platforms show the correct card layout on the first share, before they have processed the image.
What is the difference between og:locale and hreflang?
og:locale tells social platforms the language of the page, using an underscore (en_US). Hreflang tells search engines about alternate language versions and uses a hyphen (en-US).