Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.

The correct Open Graph image tag is a meta element in your page’s <head>: <meta property="og:image" content="https://example.com/og-image.jpg" />. Use an absolute, publicly reachable image URL, and include the four required Open Graph properties—og:title, og:type, og:image, and og:url—so social crawlers can represent the page reliably.

Copy-ready Open Graph image example

Place this block between the opening and closing <head> tags of the page you want to share:

<html prefix="og: https://ogp.me/ns#">
<head>
  <meta property="og:title" content="Example page title" />
  <meta property="og:type" content="website" />
  <meta property="og:url" content="https://example.com/page" />
  <meta property="og:image" content="https://example.com/og-image.jpg" />
  <meta property="og:image:alt" content="A concise description of the image contents" />
</head>
</html>

The Open Graph protocol describes a web page as a rich object in a social graph. The official specification defines the four basic properties shown above: og:title, og:type, og:image, and og:url. See the Open Graph Protocol documentation and its official property definitions.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What og:image does

og:image is an HTML meta property. Its content value is the URL of the image that represents the page when a platform creates a link preview. It is not an image displayed in the page body, and it does not replace an ordinary <img> element.

  • property: exactly og:image for the image URL.
  • content: an absolute URL such as https://example.com/og-image.jpg, not a relative path such as /images/og-image.jpg.
  • Location: the document’s <head>, alongside the other metadata.

The crawler must be able to request the URL without a login, browser interaction, or a page-specific session. Use HTTPS when the page is served over HTTPS, and make sure the server returns the image itself rather than an HTML error page.

Required and optional properties

Property Purpose Example
og:title Title of the shared object Example page title
og:type Object type, such as a website website
og:url Canonical URL of the object https://example.com/page
og:image URL of the representative image https://example.com/og-image.jpg
og:image:alt Text description of the image content A concise description of the image contents
og:image:secure_url HTTPS alternative for an image URL https://example.com/og-image.jpg
og:image:type Image MIME type image/jpeg
og:image:width Image width in pixels 1200
og:image:height Image height in pixels 630

The structured properties are optional, but they remove ambiguity for crawlers and tools. The specification defines og:image:url as equivalent to og:image, og:image:secure_url as an HTTPS alternative, and the type, width, height, and alt fields as metadata about that image. The specification recommends providing alt text whenever og:image is present.

Where to put the tag in HTML

  1. Open the template that outputs the page’s HTML document.
  2. Find the <head> element. In a CMS, this may be a global layout, theme header, or SEO metadata component.
  3. Add the Open Graph block before </head>. Do not put it in the visible page body.
  4. Replace the example title, canonical URL, type, image URL, and alt text with values for that page.
  5. Deploy the change, then fetch the public HTML and inspect the response—not only the source file in your editor.

If a framework renders metadata server-side, ensure these tags are present in the initial HTML response. A tag inserted only after client-side JavaScript runs may not be available to every social crawler.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Sale
HTML and CSS: Design and Build Websites
  • HTML CSS Design and Build Web Sites
  • Comes with secure packaging
  • It can be a gift option

Image URL and file requirements

Use an absolute, reachable URL

Use the complete URL, including scheme and host. The URL should return the image directly with a suitable content type, remain available to unauthenticated requests, and avoid temporary URLs that expire before a crawler fetches them. Confirm that redirects, access rules, hotlink protection, and a robots policy do not prevent the social platform from retrieving it.

Choose dimensions deliberately

The Open Graph specification defines width and height fields but does not mandate one universal pixel size. A current third-party Facebook guide recommends 1200 × 630 pixels. Treat that as platform guidance rather than a protocol requirement, and recheck the Facebook platform guidance when publishing a new design. If you publish dimensions, make sure they describe the actual file.

Write useful alt text

og:image:alt describes what is in the image; it is not a caption or a marketing slogan. For a product illustration, describe the visible product and context. If the image contains meaningful text, mention the text only when it helps identify the visual. Keep the value concise and do not leave it as generic text such as “image”.

Adding structured image metadata

This version supplies the common structured properties:

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
<meta property="og:image" content="https://example.com/og-image.jpg" />
<meta property="og:image:secure_url" content="https://example.com/og-image.jpg" />
<meta property="og:image:type" content="image/jpeg" />
<meta property="og:image:width" content="1200" />
<meta property="og:image:height" content="630" />
<meta property="og:image:alt" content="A concise description of the image contents" />

Only declare values you can keep accurate. For example, use the MIME type actually returned by the server, and do not state 1200 × 630 if the file has different dimensions.

Using more than one Open Graph image

Repeat the root og:image property for each candidate:

Rank #4
Sale
Web Design with HTML, CSS, JavaScript and jQuery Set
  • Brand: Wiley
  • Set of 2 Volumes
  • A handy two-book set that uniquely combines related technologies Highly visual format and accessible language makes these books highly effective learning tools Perfect for beginning web designers and front-end developers
<meta property="og:image" content="https://example.com/first.jpg" />
<meta property="og:image:width" content="1200" />
<meta property="og:image:height" content="630" />

<meta property="og:image" content="https://example.com/second.jpg" />
<meta property="og:image:width" content="1200" />
<meta property="og:image:height" content="630" />

Structured properties apply to the most recent root image. In this example, the first width and height belong to first.jpg; properties following the second og:image belong to second.jpg. The first image has priority when there is a conflict, so put your preferred candidate first. Keep each image’s structured fields together to avoid accidental association.

Framework and CMS implementation checklist

  • Generate a unique og:title, og:url, and og:image for every shareable canonical page.
  • Escape attribute values correctly if titles or URLs contain quotation marks or special characters.
  • Render tags in the document head, not inside a component that appears only after a user action.
  • Use a stable image URL and keep the old URL working when replacing artwork that has already been shared.
  • Make the image readable at the intended preview crop; keep essential text away from edges.
  • After deployment, inspect the raw response with an HTTP client and check the image URL separately.

How to test an og:image implementation

Inspect the HTML response

Request the public page and search for property="og:image". Verify that the returned HTML contains one or more expected absolute URLs. Browser developer tools can show the parsed DOM, but the raw response is useful for detecting tags that JavaScript adds too late for a crawler.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Inspect the image response

Open the image URL directly and verify that it loads without cookies or authentication. Check the response’s content type, final URL after redirects, dimensions, and whether an intermediary returns an error document instead of the image.

Preview the rendered result

A screenshot of the page can reveal a broken layout or an image URL that was mistyped, although a screenshot does not replace checking the metadata itself. ScreenshotNeo can capture a page while you inspect the deployed result; its API and options are documented at screenshotneo.com/docs/.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

For a quick visual check of a deployed page, call ScreenshotNeo’s API directly:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com/page -o shot.webp
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://example.com/page"}, timeout=90)
open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://example.com/page' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

Before capture, ScreenshotNeo accepts the cookie or consent banner like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each cleanup step can be disabled. Bot checks and CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and the response identifies the result with X-Page-Verdict and X-Billed headers. Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients. One thousand screenshots per month are free without a card; paid plans start at $5 for 3,000 shots. Create a free ScreenshotNeo account.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Common problems and fixes

The preview shows the wrong image

  • Confirm that the page contains the intended URL, not a stale template value.
  • If several images are declared, move the preferred image to the first position and keep its structured fields immediately after it.
  • Allow time for the platform’s crawler cache to refresh, then test the current public response again.

The image is missing or broken

  • Replace a relative URL with a complete HTTPS URL.
  • Remove authentication, IP restrictions, or hotlink rules that block the crawler.
  • Check that the URL returns an image MIME type and not an HTML error page.

The dimensions or crop look wrong

  • Measure the actual file and correct og:image:width and og:image:height if they are present.
  • Design with the platform’s crop in mind; 1200 × 630 is guidance for Facebook, not a universal protocol rule.
  • Keep important logos and text inside a safe central area.

The tags are absent from the fetched page

  • Check the server-rendered HTML rather than only the post-JavaScript DOM.
  • Inspect the CMS or framework layout that owns <head> and confirm the metadata component runs for this route.
  • Look for malformed attributes or duplicate templates that overwrite the intended values.

Quick pre-release checklist

  1. Four basics exist: og:title, og:type, og:url, and og:image.
  2. The image URL is absolute, HTTPS, public, stable, and returns the image directly.
  3. Alt text describes the visual, and optional type, width, height, and secure URL values are accurate.
  4. If multiple images exist, the preferred one is first and each image’s structured properties follow it.
  5. The tags appear in the initial document head and match the canonical page.
  6. The deployed HTML and image URL have both been fetched and checked.

Frequently Asked Questions

Is og:image:url different from og:image?

No. The Open Graph specification defines og:image:url as identical to og:image; most implementations use the shorter root property.

Does Open Graph require a 1200 × 630 image?

No. The protocol defines width and height properties but no universal pixel size. A Facebook guide recommends 1200 × 630 as platform guidance, which can change independently of the protocol.

Can I use a relative path in og:image?

Use an absolute URL instead. A complete HTTPS URL gives crawlers an unambiguous resource to request from any page context.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.