Skip to main content

Complete Guide to Open Graph Protocol

Everything you need to know about creating perfect social media previews

What is Open Graph Protocol?

Open Graph Protocol is a set of meta tags that control how URLs are displayed when shared on social media platforms like Facebook, Twitter, LinkedIn, and messaging apps like WhatsApp and Slack.

Created by Facebook in 2010, Open Graph has become the de facto standard for controlling social media previews. When someone shares your link, social platforms read these meta tags from your HTML to generate a rich preview with an image, title, and description.

Key Benefit: Without Open Graph tags, social platforms will guess what to display—often resulting in broken images, generic titles, or missing information. With proper Open Graph tags, you control exactly how your content appears.

Essential Open Graph Tags

These four tags are the foundation of every Open Graph implementation:

og:title

The title of your content as it should appear in social feeds.

<meta property="og:title" content="Your Page Title" />

Best Practice: Keep between 60-95 characters. Facebook truncates around 88-100 characters.

og:description

A brief description of your content, displayed below the title.

<meta property="og:description" content="Your page description" />

Best Practice: Aim for 155-200 characters. Most platforms truncate after 200 characters.

og:image

The URL of the image that represents your content.

<meta property="og:image" content="https://example.com/image.jpg" />

Best Practice: Use 1200×630 pixels (1.91:1 ratio). Minimum 200×200px. PNG or JPG format.

og:url

The canonical URL of your page.

<meta property="og:url" content="https://example.com/page" />

Best Practice: Use the full canonical URL with protocol (https://).

Optimal Image Sizes for Social Media

Different platforms have different image requirements. Here's what works best:

PlatformRecommended SizeAspect RatioMinimum Size
Facebook1200 × 630px1.91:1200 × 200px
Twitter1200 × 675px16:9120 × 120px
LinkedIn1200 × 627px1.91:1200 × 200px
WhatsApp1200 × 630px1.91:1200 × 200px

Pro Tip: Using 1200×630px works great across all platforms. This "universal" size is what we recommend for most use cases.

Common Mistakes and How to Fix Them

❌ Using Relative Image URLs

Problem: /images/photo.jpg

Solution: Always use absolute URLs with protocol: https://example.com/images/photo.jpg

❌ Image Too Small or Wrong Aspect Ratio

Problem: Using images smaller than 200×200px or with extreme aspect ratios results in poor display quality or cropping.

Solution: Use 1200×630px images. If you must use a different size, keep the 1.91:1 aspect ratio.

❌ Forgetting to Update Tags After Changes

Problem: Social platforms cache your Open Graph data. Updating tags doesn't immediately change how links appear.

Solution: Use debugging tools to clear cache:

❌ Missing Twitter Card Tags

Problem: Twitter uses its own "Twitter Card" meta tags alongside Open Graph.

Solution: Always include Twitter Card tags for Twitter/X:

<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content="Your Title" />
<meta name="twitter:description" content="Your description" />
<meta name="twitter:image" content="https://example.com/image.jpg" />

❌ Title or Description Too Long

Problem: Text gets truncated with "..." and important information is cut off.

Solution: Keep titles under 95 characters and descriptions under 200 characters.

Self-Audit Checklist

Use this checklist to ensure you've covered all the common mistakes. Check off each item as you verify your implementation:

All checked? Great! Use our validator to verify everything is working correctly. Validate your tags now →

Platform-Specific Requirements

Facebook & Meta Platforms

  • Requires og:title, og:image, og:url at minimum
  • Images must be at least 200×200px
  • Recommended size: 1200×630px
  • Use og:type to specify content type (website, article, video, etc.)
  • Add og:site_name for branding

Twitter / X

  • Uses twitter:card in addition to Open Graph tags
  • Two card types: summary (small image) and summary_large_image (big image)
  • Recommended: summary_large_image for most content
  • Can fall back to Open Graph tags if Twitter tags are missing
  • Add twitter:site and twitter:creator for attribution

LinkedIn

  • Uses standard Open Graph tags
  • Image size: 1200×627px recommended
  • Minimum image size: 200×200px
  • Professional content performs better—keep it business-appropriate

WhatsApp

  • Uses Open Graph tags just like Facebook
  • Shows preview in chat bubbles
  • Works best with 1200×630px images
  • Title and description are both displayed

Using Video Open Graph Tags

Beyond images, Open Graph supports video content. When you share a video URL, social platforms can embed and play the video directly in the feed.

When to Use Video OG Tags

  • Sharing video content hosted on your own server
  • Creating rich video previews on Facebook and LinkedIn
  • Embedding promotional or educational videos in social feeds
  • Providing alternative video formats for different platforms

Essential Video Tags

og:video

The URL of the video file. Should be a direct link to the video file (MP4, WebM, etc.).

<meta property="og:video" content="https://example.com/video.mp4" />

Best Practice: Use HTTPS URLs. Some platforms may not load videos over HTTP.

og:video:type

The MIME type of the video file.

<meta property="og:video:type" content="video/mp4" />

Common types: video/mp4, video/webm, video/ogg, application/x-shockwave-flash

og:video:width & og:video:height

The dimensions of the video in pixels.

<meta property="og:video:width" content="1280" />
<meta property="og:video:height" content="720" />

Recommended: Use standard video resolutions like 1280×720 (720p) or 1920×1080 (1080p).

og:video:duration (Optional)

The duration of the video in seconds.

<meta property="og:video:duration" content="120" />

Example: 120 = 2 minutes, 300 = 5 minutes

Complete Video Example

Here's a complete example of video Open Graph tags:

<meta property="og:type" content="video.other" />
<meta property="og:title" content="Product Demo Video" />
<meta property="og:description" content="See how our product works in action" />
<meta property="og:url" content="https://example.com/demo" />

<!-- Video tags -->
<meta property="og:video" content="https://example.com/videos/demo.mp4" />
<meta property="og:video:type" content="video/mp4" />
<meta property="og:video:width" content="1280" />
<meta property="og:video:height" content="720" />
<meta property="og:video:duration" content="180" />

<!-- Fallback image if video doesn't load -->
<meta property="og:image" content="https://example.com/video-thumbnail.jpg" />

Important: Always include a fallback og:image tag. Some platforms may not support video embedding and will display the image instead.

Platform Support Notes

  • Facebook: Supports native video playback with og:video tags
  • LinkedIn: Supports video tags but may show thumbnail only
  • Twitter: Prefers Twitter Player Card for video content
  • WhatsApp: Usually shows thumbnail, not embedded video

Debugging Tools & Validators

Use these official platform tools to test your Open Graph tags, clear cache, and see exactly how your content will appear when shared.

Facebook Sharing Debugger

Test how your page appears on Facebook, Instagram, and WhatsApp. Shows exactly what Facebook sees and lets you scrape new data to clear cache.

Open Facebook Debugger

Twitter Card Validator

Preview how your Twitter Cards will look and validate that all required tags are present. Essential for Twitter/X sharing optimization.

Open Twitter Validator

LinkedIn Post Inspector

See how your content will appear when shared on LinkedIn. Helps ensure professional presentation for business content.

Open LinkedIn Inspector

OGPreview.io Validator

Our comprehensive validator checks your tags, validates images, and provides actionable recommendations all in one place.

Use Our Validator

💡 Pro Tip: Always Clear Cache

Social platforms cache your Open Graph data aggressively. After updating your tags, always use these debugging tools to force a fresh fetch. Otherwise, your changes won't appear immediately when shared.

Frequently Asked Questions

Common questions about Open Graph Protocol and social media previews.

Ready to Create Perfect Previews?

Use our generator to create your Open Graph tags in minutes, then validate them to make sure everything looks perfect.

© 2025 OGPreview.io - Open Graph Preview Tool