Glossary
og:image
The og:image tag is the Open Graph meta tag that sets the image shown when a page is shared as a link on social platforms and in chat apps.
An og:image is the Open Graph meta tag that names the image a platform should show when a page is shared as a link. It sits in the page’s HTML head as <meta property="og:image" content="https://example.com/card.png">, and Facebook, LinkedIn, Slack, Discord, WhatsApp and most other apps read it when they build a link preview. Of all the Open Graph properties, it has the largest effect on how a shared link looks, because in most feeds and chat apps the image takes up more space than the title and description combined.
The tag is part of the Open Graph protocol, which Facebook published in 2010 to let any web page describe itself as an object in a social graph. The protocol requires four properties on every page: og:title, og:type, og:url and og:image. In practice many pages omit og:type and og:url, but very few previews look right without an image, so og:image is the property site owners most often add, check and fix.
How og:image is used
When a URL is shared, the platform’s crawler fetches the page, parses the head for meta tags and finds the og:image value. It then makes a second request, this time for the image itself, checks its type and dimensions, and stores a resized copy on its own servers. The card that readers see uses that stored copy, which is why changing the file at the same URL often has no visible effect until the platform fetches it again.
The same tag feeds many consumers. X reads it when a page has no twitter:image, as described under Twitter Cards. Chat apps use it during link unfurling. Search engines may use it as a thumbnail candidate, and preview APIs return it as the main image field of their response. One well-chosen og:image therefore covers most of the places a link can appear.
Structured image properties
Open Graph defines optional properties that describe the image in more detail. They follow the og:image tag they refer to.
Property | What it holds |
|---|---|
og:image | The image URL (the same as og:image:url) |
og:image:secure_url | An HTTPS URL for the image, if og:image uses HTTP |
og:image:type | The MIME type, such as image/png or image/jpeg |
og:image:width | Width in pixels |
og:image:height | Height in pixels |
og:image:alt | A text description of the image |
Width and height are worth adding. Meta’s documentation says that when the crawler knows the dimensions in advance it can render the image on the first share, without downloading and processing it first. Without them, the first person to share a new URL may see a card with no image while the crawler catches up. The type property helps parsers that check the MIME type before fetching, and the alt property gives screen reader users a description of the picture.
A page can include more than one og:image. Each tag starts a new image, and the structured properties after it apply to that image. Most consumers use the first one and ignore the rest, so the preferred image should come first in the head.
Recommended sizes
Meta recommends an image of 1200 by 630 pixels for the best result on high-resolution screens, at an aspect ratio of about 1.91:1 so the full image shows in the feed without cropping. Images of at least 600 by 315 pixels display as large link previews; smaller ones still appear, but at a much smaller size. The minimum Meta accepts is 200 by 200 pixels, and files can be up to 8 MB.
Other platforms are close enough that one image usually serves them all. LinkedIn uses a similar 1.91:1 ratio. X’s summary_large_image card uses 2:1, so a 1200 by 630 image is cropped slightly at the top and bottom; teams that care about X can add a separate twitter:image at 1200 by 600. Chat apps such as Slack and Discord scale the image to fit their own layout.
Platform | Typical ratio | Common working size |
|---|---|---|
Facebook and Meta apps | 1.91:1 | 1200 × 630 |
1.91:1 | 1200 × 627 | |
X (summary_large_image) | 2:1 | 1200 × 600 |
Slack, Discord, Teams | Scaled to fit | 1200 × 630 works well |
Keep important content, especially text and logos, inside a central safe area, because each platform crops a little differently and some show the image in a small square on mobile. JPG and PNG are the safest formats. WebP is accepted by many consumers but not all, so a PNG or JPG fallback is the cautious choice. Keep the file well under the limits; a 200 KB image loads faster in every crawler than a 6 MB one, and some unfurlers give up on large files.
Common og:image problems
Most failures come from the URL. The value must be an absolute URL with the scheme and domain, such as https://example.com/images/card.png. A relative path like /images/card.png is resolved by some consumers and ignored by others. The image must also be publicly reachable: images behind a login, a signed URL that expires within minutes or a CDN rule that blocks unknown bots all produce a card with no picture. Redirects add risk, since every hop is another chance to fail, so serve the image from its final address and avoid a long redirect chain.
The second group of problems comes from how the tag is added. Single-page applications often set og:image with client-side JavaScript after the page loads. Many crawlers read only the HTML the server returns, so the tag never appears. JavaScript rendering on the consumer side or server-side rendering on the site side fixes this.
The third group is caching. Platforms store the first image they see for a URL. Replacing the file at the same address, or changing the tag, does not update cards that already exist. Meta’s Sharing Debugger can force a fresh scrape for Facebook, and the usual approach elsewhere is to change the image filename, for example by adding a version number, so that consumers see a new URL. Over time, images also disappear when sites are redesigned, and link rot leaves old posts with broken thumbnails.
Finally, some sites use the tag carelessly or misleadingly: the same generic logo on every page, a stock photo unrelated to the content, or an image that promises something the page does not deliver. 10 websites that lie in their Open Graph tags looks at examples.
Generating og:image automatically
Sites with thousands of pages rarely design each image by hand. The common pattern is a template: a fixed layout with the page title, author, date and logo drawn onto a branded background, rendered on demand or at build time. Frameworks such as Next.js include image generation routes for this, and many teams use a headless browser to render an HTML template to PNG. Screenshot services do the same from a URL; the Exabase Screenshot API is one option, and the best screenshot APIs roundup compares others.
Generated images have trade-offs. They are consistent and always match the title, but they look alike across a whole site, which can make shared links less distinctive. Rendering on demand adds latency to the crawler’s request, so cache the output and set long cache headers. Strip unneeded metadata from photos before publishing them as preview images; camera EXIF data can include location and device details that nobody intended to share.
A worked example
A publisher runs a documentation site with 400 pages, all sharing one og:image: the company logo on a white square. Links to the docs look identical in Slack and on LinkedIn, and the logo is cropped badly in the 1.91:1 frame. The team builds a template at 1200 by 630 pixels that shows each page’s title, section name and a coloured band for the product area, generated at build time and served from the same domain as static PNG files of about 80 KB each.
They add og:image:width, og:image:height, og:image:type and og:image:alt beside each og:image tag, plus a separate twitter:card set to summary_large_image. Before launch, they run a script that requests each page, reads the head and confirms that the image URL is absolute, returns 200 with an image content type and measures 1200 by 630. Three pages fail because their titles contain characters the template could not render, and those are fixed before release. Existing posts keep their old logo cards until each platform refreshes its cache, so the team re-scrapes the twenty most-shared URLs in Meta’s Sharing Debugger.
og:image and other preview metadata
og:image works alongside the rest of a page’s preview metadata. The favicon identifies the site in small spaces, the canonical URL tells consumers which address to attribute the card to, and oEmbed replaces the static image with a playable embed for video and audio. Search engines read schema.org structured data, which has its own image property; keeping the two consistent avoids different thumbnails in search results and social feeds. Taken together, these fields form the page’s URL metadata.
Where Exabase fits
Exabase reads og:image on the consumer side. The Link Preview API returns a page’s preview with a single GET /v2/link request, and the image field includes a pre-signed URL, the width and the height, along with the file size and MIME type, so you can lay out a card without fetching the image yourself. If a page has no Open Graph tags, the API falls back to the first usable image, the page title and the meta description. Pages are rendered with JavaScript before parsing, redirects are followed, and results are cached for up to 24 hours. The first 20,000 previews each month are free. The link preview guide and the LinkPreview model document the response.
When a link should be kept, save it as a bookmark in Resources: Exabase captures the title, description, site name, favicon, a screenshot and a reader-mode copy of the page, and makes the content searchable through Deep Search. Images uploaded to Resources get thumbnails, captions, dominant colours and OCR text. For full page content, Extract returns text chunks. To compare preview services, see the best link preview APIs and Exabase vs OpenGraph.io.
Frequently asked questions
What is og:image?
og:image is the Open Graph meta tag that sets the image shown when a page is shared as a link on social platforms, chat apps and other services that build previews.
What size should an og:image be?
Use 1200 by 630 pixels at a 1.91:1 ratio. Meta’s minimum is 200 by 200 pixels, images under 600 by 315 show as small previews, and files can be up to 8 MB.
Why is my og:image not showing?
Usually the URL is relative or not publicly reachable, the tag is added by client-side JavaScript, the image is too large or the wrong type, or the platform has cached an earlier version of the page.
How do I update an og:image that a platform has cached?
Change the image URL, for example by adding a version number to the filename, or ask the platform to re-scrape the page. For Facebook, use Meta’s Sharing Debugger.
Do I need both og:image and twitter:image?
No. X uses og:image when twitter:image is missing. Add twitter:image only if you want a different image or crop for X. See Twitter Cards.
Should I set og:image:width and og:image:height?
Yes. Meta says the dimensions let its crawler render the image on the first share, instead of showing a card without an image while it processes the file.
Can I read a page’s og:image through an API?
Yes. The Exabase Link Preview API returns the og:image with a pre-signed URL, dimensions, file size and MIME type, and falls back to the first usable image when the tag is missing.
Related pages: Open Graph, Twitter Cards, meta tags, link preview, link unfurling, favicon, URL metadata, free Link Preview API, best link preview APIs, Exabase vs Microlink