GitHub Social Preview Checker — Test Your Repo Link Before Sharing
Table of Contents
GitHub generates Open Graph meta tags for every public repository. When you share a repo link on Twitter, LinkedIn, or Slack, you get a preview card showing the repo name, description, and either your custom social preview image or the GitHub-generated card with your avatar.
The default GitHub-generated preview is fine, but a custom social preview image makes your repo stand out in feeds, conference tweets, and community posts. Testing what your repo looks like before sharing takes 30 seconds with an OG tag checker.
Here is how GitHub's social preview works and how to customize and verify it.
How GitHub Generates OG Tags for Repos
GitHub automatically generates Open Graph tags for every public repository. You do not need to configure anything for a basic preview to work. The default tags GitHub generates look like this:
- og:title — repository name (e.g., "username/repo-name")
- og:description — the repository description you set in About settings
- og:image — a generated card showing your avatar, repo name, and stats — or your custom social preview image if you have set one
- og:url — the repository URL
- twitter:card — summary_large_image (GitHub always uses the large card format)
The generated og:image card from GitHub includes your profile picture, the repo name, and a few stats. It is functional but generic. A custom social preview image lets you brand the card more distinctively.
How to Set a Custom GitHub Social Preview
Setting a custom social preview image replaces the generated GitHub card with your own image.
- Go to your repository on GitHub
- Click Settings in the repository navigation
- Scroll down to the Social preview section
- Click Edit and upload your image
- Click Save changes
Image requirements for GitHub social preview
- Minimum 640x320 pixels
- Recommended 1280x640 pixels
- Formats: PNG, JPG, GIF
- Maximum file size: 1MB
The recommended 1280x640 pixels is a 2:1 aspect ratio, which works well for Twitter's summary_large_image card format and scales acceptably for LinkedIn and Slack.
After saving, GitHub updates the og:image for all pages in the repository. The change is immediate — you do not need to wait for any regeneration.
Sell Custom Apparel — We Handle Printing & Free ShippingTesting Your GitHub Social Preview
To verify your GitHub social preview, check the OG tags on the repo page.
Using the HTML paste method
- Open your GitHub repository page in a browser
- Press Ctrl+U (or Cmd+U) to view source
- Copy the full HTML
- Paste into the OG checker
- Click Check Tags
In the results, look for the og:image value. It should be a GitHub CDN URL (usually opengraph.githubassets.com for generated images, or your uploaded image URL for custom previews). The rendered preview card shows how the repo link will look when shared.
Checking a specific commit, branch, or release
GitHub also generates OG tags for individual commits, pull requests, issues, and releases. The og:image for these pages is always the generated GitHub card, not the custom social preview image you set at the repo level. Only the main repository page and the GitHub user/organization page use the custom social preview image.
GitHub Social Preview Best Practices
A well-designed GitHub social preview image increases clicks from Twitter, LinkedIn, and conference slides.
What to include in the image
- Project name or logo — large and readable at thumbnail size
- One-line description of what the project does
- A technology badge or stack indicator if relevant
- Your organization or personal brand
What to avoid
- Code screenshots — they become unreadable at preview size
- Long paragraphs of text
- Dark text on dark backgrounds
- Important content in the corners (may be cropped by some platforms)
Design tools
Figma, Canva, and similar tools all work well for creating social preview images. Use a 1280x640 canvas. Keep the main content in the center 900x480 safe zone to avoid cropping on any platform.
Consistency across repos
If you maintain multiple repositories, using a consistent template with your branding creates a recognizable identity when your repos appear in feeds or search results. Build a template once and reuse it with the project name swapped in.
GitHub OG Tags vs Platform Previews
Different platforms render GitHub repo previews slightly differently.
Twitter / X
GitHub sets twitter:card to summary_large_image, so Twitter shows a full-width preview image above the repo title and description. If you share a GitHub link without a custom social preview, the generated GitHub card shows your avatar and repo stats in a clean branded layout.
LinkedIn shows the og:image as a smaller card on the left with the title and description on the right in feed posts, or as a large banner in article posts. LinkedIn's preview works cleanly with the standard GitHub OG tags.
Slack
Slack shows a compact unfurl card with a thumbnail version of the og:image beside the repo title and description. Slack also shows the repo's star count and language in the unfurl if it recognizes the GitHub URL pattern.
Discord
Discord shows the og:image as a smaller thumbnail in the embed. For repo links specifically, Discord usually renders the image with some additional whitespace — the custom social preview image shows more clearly than the generated GitHub card at Discord's display size.
Try It Free — No Signup Required
Runs 100% in your browser. No data is collected, stored, or sent anywhere.
Open Free OG Tag CheckerFrequently Asked Questions
My GitHub repo social preview image is not updating after I changed it. How do I fix this?
After updating the social preview image in GitHub Settings, clear the platform cache. For Twitter, go to cards-dev.twitter.com/validator and enter your repo URL to force a refresh. For LinkedIn, use the Post Inspector. The GitHub image itself updates immediately, but Twitter and LinkedIn cache the og:image URL they previously fetched.
Can I set different social preview images for different branches of my repo?
No. GitHub only supports one social preview image per repository, set at the repo level in Settings. It applies to the repository homepage regardless of which branch is being viewed. Individual branches, commits, and pull requests use the generated GitHub card, not the custom image.
Why does my GitHub repo show a different preview on LinkedIn than on Twitter?
LinkedIn and Twitter use the same og:image URL, but they crop and display it at different aspect ratios. LinkedIn uses a portrait-skewed crop in some contexts while Twitter uses a 2:1 landscape. The 1280x640 recommended size is close to 2:1 and displays well on both, though LinkedIn may show it in a smaller card format depending on post type.

