OGMagic
By OGMagic··8 min read

The Complete Guide to Open Graph Images in 2026

Everything developers need to know about OG images — what they are, why they matter, recommended sizes, best practices, and how to automate them for your blog or app.

Open Graph image example

What Are Open Graph Images?

Open Graph (OG) images are the preview images that appear when you share a link on social media platforms like Twitter/X, Facebook, LinkedIn, Slack, Discord, and iMessage. They're defined by the og:image meta tag in your page's HTML.

When someone shares your URL, the platform's crawler fetches your page, reads the Open Graph meta tags, and displays a rich preview card with your image, title, and description. Without an OG image, your links appear as plain text — or worse, with a random auto-generated thumbnail.

Why OG Images Matter

Custom OG images help readers understand a shared page before opening it. A useful preview can provide:

  • Visual attention: Images catch the eye in a sea of text posts
  • Trust signals: A polished preview suggests quality content
  • Brand consistency: Recognizable designs build brand awareness
  • Context: A good OG image tells people what to expect before clicking
  • SEO impact: Higher click-through rates from social → better signal to search engines

Recommended Sizes

The standard OG image size is 1200 × 630 pixels (1.91:1 ratio). This works across all major platforms:

PlatformRecommended SizeMin Size
Twitter/X1200 × 628600 × 335
Facebook1200 × 630600 × 315
LinkedIn1200 × 6271200 × 627
Discord1200 × 630Any
Slack1200 × 630Any

TL;DR: Use 1200 × 630. It works everywhere.

Essential Meta Tags

Here are the meta tags you need in your <head>:

<!-- Open Graph (Facebook, LinkedIn, Discord, Slack) -->
<meta property="og:title" content="Your Page Title" />
<meta property="og:description" content="A brief description of your page" />
<meta property="og:image" content="https://yoursite.com/og-image.png" />
<meta property="og:image:width" content="1200" />
<meta property="og:image:height" content="630" />
<meta property="og:type" content="website" />
<meta property="og:url" content="https://yoursite.com/page" />

<!-- Twitter Card -->
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content="Your Page Title" />
<meta name="twitter:description" content="A brief description" />
<meta name="twitter:image" content="https://yoursite.com/og-image.png" />

Best Practices

1. Keep Text Large and Readable

OG images are often displayed at small sizes (300-600px wide). Use large, bold text — at least 48px at 1200px canvas width. Avoid small details that disappear when scaled down.

2. Use High Contrast

Light text on dark backgrounds (or vice versa) reads best. Avoid placing text over busy images without a gradient overlay.

3. Include Your Brand

Add your logo or domain name so people recognize your content when shared. Place it in a consistent position (bottom-left or top-right works well).

4. Design for the Safe Zone

Different platforms crop images slightly differently. Keep important content (text, logos) within the center 80% of the image to avoid cutoffs.

5. Optimize File Size

Keep images under 5MB (ideally under 1MB). Platforms may not fetch large images or may timeout. PNG for text-heavy images, JPEG for photos.

6. Use Absolute URLs

Always use full absolute URLs (starting with https://) for og:image. Relative paths won't work with social media crawlers.

Automating OG Image Generation

Manually creating OG images for every blog post or page doesn't scale. Here are your options:

Option 1: Use an API (Recommended)

A hosted image service can create the PNG for you. Run the creation request privately, then put the returned URL in your meta tag:

// Run on your server, at build time, or when publishing content.
const response = await fetch("https://www.ogmagic.dev/api/images", {
  method: "POST",
  headers: {
    Authorization: "Bearer " + process.env.OGMAGIC_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ title: "My article", template: "gradient-mesh" }),
});
if (!response.ok) throw new Error("Image creation failed");
const image = await response.json();
// Save image.url with your content; use it in og:image and twitter:image.

This is the approach OGMagic takes — 55+ templates, email access for the free tier (50 new images per 30 days), and a one-time €10 / US $12 Pro tier for higher limits and premium templates.

Option 2: Build-Time Generation

Generate images during your build step using libraries like Satori (JSX → SVG) + Resvg (SVG → PNG). This works well for static sites but adds build complexity.

Option 3: Screenshot Services

Tools like Puppeteer or Playwright can screenshot an HTML page to create OG images. This gives you browser rendering, while requiring you to manage browser resources, font loading, and image delivery. Measure generation time with your own design and environment.

Testing Your OG Images

Use these free tools to verify your OG tags work correctly:

  • Facebook Sharing Debugger: developers.facebook.com/tools/debug
  • Twitter Card Validator: cards-dev.twitter.com/validator
  • LinkedIn Post Inspector: linkedin.com/post-inspector
  • opengraph.xyz: Preview how your link looks across platforms

Common Issues

Image Not Showing Up

  • Check that the image URL is absolute (starts with https://)
  • Verify the image is accessible (not behind auth or firewall)
  • Ensure the image is under 5MB
  • Clear the platform's cache using their debug tools

Wrong Image Showing

  • Platforms cache OG images aggressively — use their debug/refresh tools
  • Check for duplicate og:image tags (first one wins)
  • Make sure there's no redirect on the image URL

Image Looks Blurry

  • Use at least 1200 × 630 resolution
  • Use PNG for text-heavy images (JPEG compression blurs text)
  • Avoid upscaling small images

Conclusion

OG images are one of the highest-ROI improvements you can make to your web presence. A few minutes of setup gives every link you share a professional, branded preview that drives more clicks.

For the fastest path from zero to beautiful OG images, try OGMagic — 55+ templates, email access, works with any framework.

Stop making OG images manually

Generate beautiful social previews with a single URL.

The OGMagic newsletter

Get your 20% off Pro code

Join the OGMagic newsletter for a 20% discount code for Pro, Open Graph tips, and new templates.