Compress to KB topic guide

Compress images for GitHub: hit the 10 MB image and GIF cap

Direct answer

GitHub attachment limits depend on file type. GitHub Docs “Attaching files” states a maximum file size of 10 MB for images and gifs, 25 MB for all other files, and separate video limits (10 MB on free plan repositories, 100 MB on paid plan repositories). When a PNG screenshot or JPEG photo for an issue, pull request, or comment approaches that image ceiling, compress to a deliberate KB budget under 10 MB before you drag it into the composer.

Try the Compress to KB

What this workflow handles

Treat the 10 MB image/GIF row in GitHub Docs as the hard budget for screenshots and still images — not the 25 MB “all other files” bucket and not the video rows unless you are attaching mp4/mov/webm. Supported image and media types listed on the same page include PNG, GIF, JPEG, SVG, and video; issue, pull request, and discussion comments can also accept additional types such as PDF and archives when you browse or drag files in (GitHub CLI supports attaching files too). For UI screenshots with text and chrome, PNG often stays sharper than JPEG; for photographs, JPEG usually shrinks faster. Large animated GIF captures can hit 10 MB before a still PNG would — if motion matters, GitHub’s video attachment path may fit better than forcing a huge GIF, subject to the free vs paid video caps in the docs. Enter a Compress to KB target safely under 10240 KB (commonly 8000–9500 KB), quality-sweep at the original dimensions first, and downscale only if the quality floor still misses the budget. GitHub also notes that for public repositories, uploaded files can be accessed without authentication — compress for size, but do not attach secrets you would not want public. Beita’s Compress to KB uses a temporary analysis upload with no long-term storage; see the Privacy Policy for retention details.

Use Compress to KB with a target under 10240 KB (for example 8000–9500 KB) before you attach a screenshot to an issue or pull request. For WhatsApp’s 5 MB image-message cap instead, see Compress image for WhatsApp.

How to use it

  1. Open GitHub Docs “Attaching files” and confirm your file is an image or GIF (10 MB cap) rather than a generic file (25 MB) or video (free vs paid video rows).
  2. Pick PNG for UI screenshots with text, JPEG for photos, and avoid oversized GIFs when a short video attachment fits GitHub’s video limits better.
  3. Enter a Compress to KB target under 10240 KB (commonly 8000–9500 KB), quality-sweep at the original dimensions first, and allow stepped downscale only if the quality floor still exceeds the budget.
  4. Confirm the output is at or under 10 MB and still readable at issue/PR width, then attach via drag-and-drop, browse, or GitHub CLI.
  5. On public repositories, re-check that the image contains nothing you would not want accessible without authentication, per GitHub Docs.

Frequently asked questions

What is GitHub’s image attachment size limit?

GitHub Docs “Attaching files” lists a maximum file size of 10 MB for images and gifs. That cap applies when you attach PNG, JPEG, GIF, SVG, or other image types through issues, pull requests, or comments. Treat 10240 KB as the ceiling and aim slightly lower so encoding and upload headroom remain.

Is the 10 MB limit the same as GitHub’s 25 MB attachment limit?

No. The same Attaching files page sets 25 MB for all other files — a different bucket from images and gifs. Videos have their own rows: 10 MB on free plan repositories and 100 MB on paid plan repositories. Size your screenshot or photo against the 10 MB image/GIF rule, not the 25 MB general file rule.

What KB target should I use in Compress to KB?

Start from 10240 KB (10 MB) and leave headroom: 8000–9500 KB is a practical target for a single issue or PR image. Quality-sweep first at the original pixel dimensions; allow stepped downscale only if the quality floor still exceeds the budget. web.dev’s compress-images guide recommends experimenting with quality rather than assuming one universal setting.

PNG, JPEG, or GIF for GitHub screenshots?

GitHub Docs lists PNG, GIF, JPEG, and SVG among supported image types. Prefer PNG for UI screenshots with sharp text; use JPEG for photos. GIF is capped at the same 10 MB as other images — a long animated capture may be easier to deliver as a short video (mp4/mov/webm) under GitHub’s video limits if motion matters more than a GIF preview.

Where can I attach images on GitHub?

GitHub Docs describes attaching files to issues, pull requests, and comments — drag and drop or browse in the browser, or use GitHub CLI to attach files. The same Attaching files page documents supported types and size limits per category.

Are attachments on public repos visible without signing in?

GitHub Docs notes that for public repositories, anyone can access uploaded files without authentication. Compress to reduce bytes, but treat attachments like public content — no credentials, private URLs, or sensitive data you would not publish.

How is this different from the email, WhatsApp, and general KB guides?

compress-image-for-email covers Gmail and Outlook.com 25 MB message attachment totals. compress-image-for-whatsapp covers Meta Cloud API 5 MB JPEG/PNG image messages. compress-image-to-kb covers forms and marketplaces (GOV.UK, LinkedIn, Shopify). This page isolates GitHub’s 10 MB image/GIF attachment rule from GitHub Docs. Same Compress to KB tool; different destination budget.

Sources

Explore the compress to kb topic cluster

This guide covers GitHub image and GIF attachment size. Related guides cover general KB budgets, email and WhatsApp caps, and the Compress to KB tool.

Related guides

All compress to kb guides