Open Graph image: size, meta tags and link previews
Set up an Open Graph image the right way: the correct size, every meta tag to copy and what iMessage and WhatsApp need for a clean link preview.
An Open Graph image is the preview picture that appears when someone shares your link in iMessage, WhatsApp or on a social network. You set it with the og:image meta tag in the head of your page, ideally as a JPG or PNG at 1200 × 630 pixels with a full https address.
Without the tag, the preview shows just a bare address or some random image from the page. A few lines of HTML make every shared link look like a small ad for your website.
What is an Open Graph image?
Open Graph is a set of meta tags a page uses to describe how it should look when shared: title, description, address and image. Nearly every service reads them, including Messages on iPhone, WhatsApp, Slack, LinkedIn and Mastodon.
Visitors never see the tags. They live in the source code and are fetched the moment someone pastes your link.
Open Graph image size and format
- Size: 1200 × 630 pixels is the common standard. For a crisp result on high-resolution displays you can serve twice that, 2400 × 1260.
- Aspect ratio: roughly 1.91 to 1. Other shapes get cropped.
- Format: JPG or PNG. Support for WebP and SVG is patchy.
- File size: as small as you can, ideally a few hundred kilobytes. Some services simply skip heavy images.
- Content: Keep what matters in the center. Some apps trim the edges or show only a small square.
Put the title into the image in large type, but don't overload it with text. In a message the preview is often only a few centimeters wide.
The meta tags to copy
These tags go into the head of every page, each with its own content:
<head>
<title>My app: notes that feel like a chat</title>
<meta name="description" content="One short sentence describing the page.">
<meta property="og:type" content="website">
<meta property="og:url" content="https://example.com/my-app">
<meta property="og:title" content="My app: notes that feel like a chat">
<meta property="og:description" content="One short sentence describing the page.">
<meta property="og:image" content="https://example.com/images/preview.jpg">
<meta property="og:image:width" content="1200">
<meta property="og:image:height" content="630">
<meta property="og:image:alt" content="iPhone showing the app">
<meta name="twitter:card" content="summary_large_image">
</head>Three things matter here:
- Full addresses: og:image and og:url need https and the domain. Relative paths like /images/preview.jpg often fail.
- State width and height: That lets the preview render correctly the very first time the link is shared.
- twitter:card: The value summary_large_image shows the image large instead of as a small square. Many other services respect this tag too.
Link previews in iMessage: what to know
Messages on iPhone and Mac build the preview from the title and the Open Graph image. Two details are worth knowing:
- No JavaScript: The tags have to be in the HTML your server delivers. Anything a script adds later in the browser is invisible to iMessage.
- Icon as fallback: Without an Open Graph image the preview only shows your site icon. How to set that up properly is covered in Favicon and Apple Touch Icon.
Test and refresh your preview
The simplest test is sending the link to yourself, in Messages or in a note. If the image is missing, check these points:
- Is the image publicly reachable at its address, without a login?
- Are the tags really in the page source?
- Is the address in the tag complete and using https?
Previews are cached for a long time. When you swap the image, give the file a new name, for example preview-2.jpg. Under the same name many recipients keep seeing the old picture for weeks.
A separate image for every page
One image for the whole site beats none at all. A dedicated image per page, carrying that page's title, works better. For blog posts this can be generated automatically: title, category and logo on a background in your color.
What else belongs on your app's page is covered in A website for your app. And how visitors get from there straight to the App Store is shown in Smart App Banner.