Control exactly how your content appears when shared on Facebook, Twitter/X, LinkedIn, Discord, and Slack — with practical code examples and testing workflows.
When someone shares your web page on social media, the preview card that appears is your first impression. A well-optimized preview with a compelling image, clear title, and engaging description can double or triple your click-through rate. A broken or missing preview makes your content look unprofessional and gets scrolled past. Open Graph (OG) tags give you complete control over these previews — and implementing them correctly is one of the highest-ROI technical SEO tasks you can perform.
Open Graph is a protocol created by Facebook in 2010 that allows web pages to become rich objects in a social graph. In practical terms, OG tags are HTML meta tags that tell social media platforms how to display a link when it is shared. They define the title, description, image, URL, content type, and other properties of your page's social preview card.
While originally a Facebook initiative, Open Graph is now supported by virtually every major social platform: Twitter/X, LinkedIn, Discord, Slack, Pinterest, iMessage, WhatsApp, Telegram, and more. When any of these platforms encounters a shared URL, they look for OG tags first. If OG tags are missing, the platform falls back to scraping the page's HTML — often producing a poor or incomplete preview.
Four OG tags are considered mandatory for a complete social preview. Without them, your share will look broken or generic on most platforms.
The title displayed in the preview card. Should be concise, compelling, and include your primary keyword.
<meta property="og:title" content="10 CSS Tricks Every Developer Should Know">
Best practices: 40-60 characters. If the title exceeds platform limits (typically 60-90 characters), it will be truncated. Front-load the most important words. Avoid generic titles like "Home" or "Blog Post."
The description shown below the title. Should summarize the page content and encourage clicks.
<meta property="og:description" content="Master advanced CSS techniques including container queries, cascade layers, and subgrid with practical code examples and browser compatibility notes.">
Best practices: 100-200 characters. Write a standalone description — do not start with "This article..." or "Click here to..." Include a specific value proposition or curiosity gap.
The image displayed in the preview card. This is the single most important element for click-through rate.
<meta property="og:image" content="https://example.com/images/css-tricks-preview.jpg">
Best practices: Use absolute URLs (not relative paths). Recommended size: 1200 × 630 pixels (1.91:1 aspect ratio). Minimum: 600 × 315. Format: JPEG (best for photos) or PNG (best for graphics/text). Keep under 5MB. Use high-contrast, visually engaging images with readable text overlays.
The canonical URL of the page. Ensures likes, shares, and comments aggregate to the correct URL.
<meta property="og:url" content="https://example.com/blog/css-tricks">
Specifies the type of content. The default is website. Use article for blog posts to enable author and publish date metadata.
<meta property="og:type" content="article">
Common types: website, article, product, profile, video.movie, music.song, book.
The name of your website or brand, displayed in smaller text above the title.
<meta property="og:site_name" content="Risetop">
The language and region of the content.
<meta property="og:locale" content="en_US">
Explicitly specify the image dimensions to help platforms render the preview correctly without needing to download and measure the image first.
<meta property="og:image:width" content="1200">
<meta property="og:image:height" content="630">
Alternative text description of the image for accessibility and context.
<meta property="og:image:alt" content="CSS code examples showing container queries and subgrid layouts">
Twitter/X has its own meta tag system called Twitter Cards. While Twitter falls back to OG tags when Twitter Card tags are absent, adding both sets ensures the best possible preview on every platform.
Specifies the card type. Three main options:
<!-- Large image with text below (recommended for articles) -->
<meta name="twitter:card" content="summary_large_image">
<!-- Small square thumbnail on the left (compact) -->
<meta name="twitter:card" content="summary">
<!-- For video content -->
<meta name="twitter:card" content="player">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="@yourbrand">
<meta name="twitter:creator" content="@authorhandle">
<meta name="twitter:title" content="10 CSS Tricks Every Developer Should Know">
<meta name="twitter:description" content="Master advanced CSS techniques...">
<meta name="twitter:image" content="https://example.com/images/css-tricks-preview.jpg">
<meta name="twitter:image:alt" content="CSS code examples">
Here is a production-ready template with all essential tags for maximum social preview quality:
<head>
<!-- Primary Meta Tags -->
<title>10 CSS Tricks Every Developer Should Know</title>
<meta name="description" content="Master advanced CSS techniques...">
<link rel="canonical" href="https://example.com/blog/css-tricks">
<!-- Open Graph / Facebook -->
<meta property="og:type" content="article">
<meta property="og:url" content="https://example.com/blog/css-tricks">
<meta property="og:title" content="10 CSS Tricks Every Developer Should Know">
<meta property="og:description" content="Master advanced CSS techniques...">
<meta property="og:image" content="https://example.com/images/css-tricks.jpg">
<meta property="og:image:width" content="1200">
<meta property="og:image:height" content="630">
<meta property="og:image:alt" content="CSS code examples">
<meta property="og:site_name" content="Your Brand">
<meta property="og:locale" content="en_US">
<!-- Twitter / X -->
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:url" content="https://example.com/blog/css-tricks">
<meta name="twitter:title" content="10 CSS Tricks Every Developer Should Know">
<meta name="twitter:description" content="Master advanced CSS techniques...">
<meta name="twitter:image" content="https://example.com/images/css-tricks.jpg">
<meta name="twitter:image:alt" content="CSS code examples">
</head>
| Platform | Image Size | Title Limit | Desc Limit | Card Type |
|---|---|---|---|---|
| 1200×630 (min 600×315) | ~65 chars | ~155 chars | og:type=article | |
| Twitter/X | 1200×628 (large) / 120×120 (small) | 70 chars | 200 chars | summary_large_image |
| 1200×627 | ~70 chars | ~100 chars | og:type=article | |
| Discord | Aspect ratio sensitive, no fixed size | No strict limit | No strict limit | OG fallback |
| Slack | Large images work well | Title + desc | Title + desc | OG fallback |
| 1000×1500 (2:3 portrait) | ~100 chars | ~500 chars | og:type=article |
og:image or Pinterest-specific markup via the Rich Pin format.
The OG image is the most impactful element of your social preview. Studies show that posts with custom images receive 2-3x more engagement than those with auto-generated or stock images. Here is how to create images that drive clicks:
For blogs and content-heavy sites, consider generating OG images automatically:
next/og: Native OG image generation in Next.js 13+developers.facebook.com/tools/debug/ — Shows exactly how Facebook renders your link, displays warnings for missing tags, and includes a "Scrape Again" button to force cache refresh.cards-dev.twitter.com/validator — Preview your Twitter Card and verify markup. Note: requires Twitter Developer account access.linkedin.com/post-inspector/ — Validates how LinkedIn displays your shared content.opengraph.xyz, metatags.io, heymeta.com — Preview across multiple platforms simultaneously.image.jpg?v=2.<head> section.SPAs built with React, Vue, or Angular present a challenge: social media crawlers typically do not execute JavaScript. If your OG tags are rendered client-side, crawlers will see empty meta tags. Solutions include:
_escaped_fragment_ convention or server-side detection to serve static HTML to crawlers.Use our free OG image preview tool to see exactly how your content looks when shared on Facebook, Twitter, LinkedIn, and Discord.
Try OG Image Preview Tool →Open Graph (OG) tags are meta tags that control how your web pages appear when shared on social media platforms like Facebook, Twitter/X, LinkedIn, and Discord. They define the title, description, image, and type of content in a shared link preview. OG was originally created by Facebook in 2010 but is now adopted by most major social platforms. Without OG tags, platforms scrape your page and often produce poorly formatted previews.
Open Graph tags (og:) are the original protocol created by Facebook and used by most platforms. Twitter Card tags (twitter:) are Twitter/X's own meta tags that override OG tags on Twitter specifically. If Twitter Card tags are not present, Twitter falls back to OG tags. For maximum compatibility, include both sets — OG tags for universal support and Twitter Card tags to customize the Twitter/X experience.
The recommended OG image size is 1200 x 630 pixels (1.91:1 aspect ratio). This size works well across all major platforms including Facebook, Twitter, LinkedIn, and Discord. Minimum size is 600 x 315 pixels, but smaller images may appear cropped or pixelated. Maximum file size varies by platform (Facebook: 8MB, Twitter: 5MB). Use JPEG or PNG format. Avoid text smaller than 40px in the image.
Use platform-specific debugging tools: Facebook Sharing Debugger (developers.facebook.com/tools/debug/), Twitter Card Validator (cards-dev.twitter.com/validator), LinkedIn Post Inspector (linkedin.com/post-inspector/), and Discord Webhook Tester. Third-party tools like opengraph.xyz and metatags.io provide multi-platform previews in one place. Always test after deploying changes, as platforms cache OG data aggressively.
Social platforms cache Open Graph data aggressively — Facebook may cache for up to 30 days. To force a refresh: use the Facebook Sharing Debugger and click "Scrape Again," or append a cache-busting query parameter to your image URL (e.g., image.jpg?v=2). For Twitter, use the Card Validator to re-fetch. Ensure your server returns the correct headers and that the image URL is accessible (not blocked by robots.txt or requiring authentication).
Published on April 10, 2026 · Last updated April 10, 2026 · 10 min read