GitHub Social Preview size (1280x640)

Resize an image to 1280x640 for a GitHub repository social preview card. Free, runs 100% in your browser with no upload, shows crisp when links are shared.

How to use GitHub Social Preview

  1. 1Upload the image you want to size for GitHub.
  2. 2Width and height are pre-filled to 1280×640px (2:1 aspect ratio).
  3. 3If your image is a different shape, it is centre-cropped to fill the frame; choose “Fit, white bars” to keep all of it.
  4. 4Download your correctly sized image — nothing is uploaded.

Features

  • Use 1280x640 (2:1), the size GitHub recommends for the best display.
  • Keep the file under 1MB, GitHub's limit; choose JPG for anything photographic.
  • Make the project name large and legible with strong contrast for busy feeds.
  • Use consistent cards across repos so an organization's projects look cohesive.

The GitHub Social Preview size (1280×640px)

The GitHub Social Preview size is 1280×640 pixels (2:1 aspect ratio). Upload your image above and Pixohub resizes it to exactly that, in your browser.

GitHub lets you set a social preview image on a repository, and it recommends 1280x640 pixels at a 2:1 ratio for the best display. This is the card that appears when someone shares your repo link on X, Slack, Discord, LinkedIn, or in a chat, so instead of the basic repository details and owner avatar GitHub shows by default, your project gets a branded card with its name, logo, or a tagline.

The 2:1 shape is close to the roughly 1.91:1 card most link previews use, so only a thin strip is trimmed on those platforms. GitHub requires the image to be a PNG, JPG or GIF under 1 MB, and that limit matters more than the pixel count: a photographic 1280x640 PNG is usually over it, while a JPG of the same card is not.

Because a preview card is scanned quickly in a busy feed or channel, keep it simple and legible: the repository or project name large, maybe a short tagline and a logo, with strong contrast and comfortable margins so nothing important sits where a platform might crop or overlay it. Consistent preview cards across your projects make an organization's repos feel like a coherent product family. GitHub can change its preview handling, so verify the current recommendation before setting it.

Official GitHub social preview specs

GitHub Docs state that a repository's social preview image should be a PNG, JPG or GIF under 1 MB, at least 640 × 320 px for good quality and 1280 × 640 px for the best display. The image is uploaded in the repository's Settings page under Social preview and replaces the card GitHub would otherwise generate automatically.

Until you add an image, GitHub's docs say repository links expand to show basic information about the repository and the owner's avatar. A custom card is worth it mainly when you want branding, a screenshot of the product or a clearer one-line pitch. You can upload one to any public repository, or to a private one that already had an image.

SpecValue
Recommended1280 × 640 px (2:1)
Minimum for good quality640 × 320 px
FormatsPNG, JPG, GIF
File size limitUnder 1 MB
Where to set itRepository → Settings → Social preview → Edit

Last updated · Source: GitHub Docs

What 1280×640 does to a real photo

GitHub's 1 MB cap decides the format here. As PNG, the 1280 × 640 card was 1.6 MB from the landscape photo and 2.0 MB from the portrait: both too big to upload. The JPG option produced 157 KB and 264 KB, well inside the limit. For any photo or screenshot, download JPG; a PNG only stays under 1 MB when the card is flat colour and text.

The 2:1 crop kept 67% of the landscape photo but only 38% of the portrait, so a portrait source needs its subject in the middle band of the frame.

We ran this page on two iPhone photos from our test set, one landscape and one portrait, with the default settings (crop to fill), then saved the same result as a JPG at 85% quality.

Landscape phone photo (4:3) keeps 67% of the photo Portrait phone photo (3:4) keeps 38% of the photoResult: 1280 × 640full frame shown
Blue is what Pixohub keeps when it centre-crops a 4:3 or 3:4 phone photo to 1280 × 640; hatched areas are cut off. Choose “Fit, white bars” to keep the whole photo instead.
PhotoOriginalKept after cropPNG resultJPG result
Portrait iPhone photo3024 × 4032, 4.7 MB38%2.0 MB264 KB
Landscape iPhone photo4032 × 3024, 1.4 MB67%1.6 MB157 KB

Last updated

What GitHub says about uploads

From GitHub's own help and developer pages, checked 24 October 2026. Each point links to the page it comes from.

What happens after upload

  • Transparent PNGs are supported, but they may look different on dark-mode or non-transparent platforms; GitHub suggests a solid background if unsure. docs.github.com

Upload limits

  • Social preview: PNG, JPG or GIF under 1 MB; at least 640 x 320 px, 1280 x 640 px for best display. docs.github.com

Why 1280×640 pixels?

2:1 is close to the 1.91:1 that Facebook and LinkedIn use for link cards, so only a thin strip is trimmed there. 1280 px is the width GitHub names for the best display, and it leaves headroom for text to stay crisp on high-DPI laptops.

The 1 MB cap is the real constraint, not the pixel count. Gradients, shadows and photographic backgrounds are what push a lossless file over it, so design the card with that limit in mind.

Common upload problems and how to fix them

GitHub rejects the upload as too large

The file is over 1 MB. PNG keeps every pixel losslessly, which is heavy for screenshots and photos. Fix: switch the download to JPG (smaller) before saving; if a flat PNG is still over, run it through Compress Image.

Shared links still show the old automatic card

Social platforms cached the preview before you uploaded the image. Fix: re-scrape the repository URL with Facebook's Sharing Debugger or LinkedIn's Post Inspector; Slack and Discord pick up the change for new shares after their caches expire.

Transparent background looks wrong in dark mode

A transparent PNG is placed on whatever background each site uses — white on one, near-black on another — so dark text or a dark logo can vanish. Fix: GitHub itself suggests a solid background if you are unsure; add one before resizing.

The project name is cut off on some sites

Platforms that use 1.91:1 trim a little from the top and bottom, and some overlay the domain in a corner. Fix: keep the name and logo at least 60 px from every edge of the 1280 × 640 canvas.

More things to know about GitHub

  • GitHub accepts PNG, JPG or GIF here; a GIF is only worth it if the card is a simple flat graphic.
  • Organisations can keep a consistent template (same background, logo position, font) and swap only the repository name for each project.
  • A short tagline that says what the project does beats a long feature list — the card is usually seen at a few hundred pixels wide.
  • Screenshots of a terminal or UI read better when cropped tight to the interesting part than when the whole window is shrunk into the card.

Frequently asked questions

Where do I upload a GitHub social preview image?

On the repository's main page click Settings (it may sit under the … menu), then under Social preview click Edit and choose Upload an image.

What happens if I don't set a social preview?

Links to the repository expand with basic information about the repository and the owner's avatar.

Can the GitHub social preview be an animated GIF?

GIF is an accepted format, but most platforms that display link cards show only a still frame, and an animated GIF easily exceeds the 1 MB limit. A static PNG or JPG is more reliable.

Why is my 1280 × 640 PNG over 1 MB?

Lossless PNG is heavy for photographic content and smooth gradients. Choose the JPG download instead, or compress the PNG, to get under GitHub's 1 MB limit.

What size is a GitHub social preview?

GitHub recommends 1280x640 pixels at a 2:1 ratio, with 640x320 as the minimum for good quality.

Why set a social preview image?

Without one, shared links show basic repository information and the owner's avatar. A custom card lets you show your project's name, logo and pitch.

Is there a file size limit?

Yes. The image must be a PNG, JPG or GIF under 1MB, so export photographic cards as JPG.

Can I use a transparent PNG?

GitHub supports it, but the card may land on light or dark backgrounds, and GitHub suggests a solid background if you are unsure.

More resize & crop tools

Batch: resize many images at once

Same processing as above, run across a set of files. Pro returns the whole batch as one ZIP. Still entirely in your browser.

Free · up to 20

PRONeed more than 20 at a time?

Pro runs up to 150 images per batch as one ZIP, keeps your brand mark on every export, and lifts the file ceiling to 200 MB.

Unlock with Pro