GIF vs PNG
Both store photographs, but they make different trade-offs. Here is where they actually differ, and how to pick.
Short answer
For anything static, PNG beats GIF on every axis and has for twenty years. For animation, the honest answer is usually neither — use a video file.
Why this comes up
GIF survives on cultural momentum rather than technical merit. People compare it to PNG for one of two reasons: they have an old GIF and want to modernise it, or they want an animation and GIF is the only animated format they can name. Those are different problems and the second one has a better answer than this page's title suggests.
Side by side
| Property | GIF | PNG |
|---|---|---|
| Compression | Lossless | Lossless |
| Transparency | Yes | Yes |
| Typical file size | 200-400% of an equivalent JPEG | 300-500% of an equivalent JPEG |
| Compatibility | Opens everywhere, including decades-old software | Opens everywhere, including decades-old software |
| Usually comes from | Websites optimising page weight | Screenshots, logos and graphics |
What actually differs
GIF is limited to 256 colours per frame
This is the defining constraint and the reason GIF photographs look dithered and speckled. PNG carries full 24-bit colour plus an 8-bit alpha channel. Any image with a gradient, a photograph, or subtle shading is being actively damaged by GIF's palette, and the damage is baked in — converting that GIF to PNG preserves the dithering, it does not undo it.
GIF transparency is one bit; PNG's is 256 levels
A GIF pixel is either fully transparent or fully opaque. There is no partial transparency, which is why GIF logos show jagged stair-stepped edges on any background other than the one they were prepared for. PNG's 8-bit alpha allows smooth antialiased edges that sit correctly on any colour. For a logo or an icon this difference alone settles it.
PNG does animate — but that is not the fix you want
APNG is animated PNG and is supported in all current browsers. It has full colour and real alpha, so it is a genuine upgrade over animated GIF in quality terms. It is still a sequence of full frames with no motion compensation, so a few seconds of video-like content remains enormous. The same clip as MP4 or WebM is routinely 10–20× smaller.
Which to use
Use GIF for
Practically nothing new. GIF is worth keeping only when a platform accepts nothing else, or when the file already exists and re-encoding gains you nothing.
Use PNG for
Every static case: logos, icons, screenshots, line art, anything needing clean transparency or more than 256 colours.
One thing that catches people out
If you are here about a screen recording, the answer is a video file
Demo clips and screen recordings exported as GIF routinely run to tens of megabytes for a few seconds, because every frame is stored whole. An MP4 or WebM of the same recording is a fraction of the size, sharper, and plays inline on every platform that matters. GIF's remaining advantage is that it autoplays silently in places that block video — a shrinking list.