Stuck on png vs gif for an image you need to publish? Choose PNG when you want lossless quality and an optional alpha channel, and treat GIF as the older, CompuServe-defined format.
This comparison belongs to the wider guide to the png file format, which gives the full background.
| Item | Value |
|---|---|
| PNG compression | Lossless |
| PNG sample depth | 1 to 16 bits |
| PNG color types | Indexed-color, greyscale and truecolor, plus an optional alpha channel |
| PNG media types | image/png and image/apng |
| GIF reference document | Version 89a, dated 31 July 1990 |
| GIF compression | LZW |
The figures come from the W3C PNG specification and the GIF89a specification. Specifications get revised, so check those sources before you rely on any figure.
What separates PNG from GIF at a glance?
The W3C’s editor’s draft describes PNG as an extensible format for the lossless, portable, well-compressed storage of static and animated raster images. The same draft calls PNG a patent-free replacement for GIF, according to the W3C PNG specification.
The GIF side of the comparison rests on the GIF89a specification, a CompuServe document dated 31 July 1990. It defines version 89a as an extension of version 87a, and it presents itself as a programming reference rather than a buyer’s guide.
These are the areas where the two formats differ most:
- Compression method: PNG uses deflate, while GIF uses LZW.
- Color handling: PNG supports indexed-color, greyscale and truecolor images.
- Transparency: PNG offers an optional alpha channel.
- Animation: PNG has its own animated media type, image/apng.
- Licensing: the two formats come with very different legal histories.
Compression and color: how each format stores pixels
PNG relies on deflate, which its specification defines as a member of the LZ77 family of compression methods. GIF relies on LZW instead. The GIF89a text even discusses a “deferred clear code” in LZW compression and says the encoder decides when the string table is cleared, per the GIF89a specification.
The W3C glossary defines lossless compression as a method that permits reconstruction of the original data exactly, bit-for-bit. That is the promise you get when you save a logo, screenshot or diagram as PNG, as the W3C PNG specification explains.
On color, PNG supports indexed-color, greyscale and truecolor images, and sample depths range from 1 to 16 bits. That range gives you room to keep a detailed image intact instead of squeezing it into a small palette.

Transparency and animation: what the sources say
PNG supports an optional alpha channel. Its glossary describes compositing as merging a foreground image and a background image, using transparency information to decide where and to what extent the background shows through.
For animation, the PNG draft defines two media types, image/png and image/apng. In an animated PNG, each image that forms part of the frame-based sequence counts as a frame, according to the W3C PNG specification.
The portion of the GIF89a text this page draws on does not spell out GIF’s transparency or animation details. Read the full GIF89a document before you make any claim about them, and test your image in the place where it will be shown.
Licensing and openness
One of PNG’s stated design goals is freedom from legal restrictions: no algorithms should be used that are not freely available. That goal sits alongside the draft’s description of PNG as a patent-free replacement for GIF, as the W3C PNG specification records.
The GIF89a document, dated 31 July 1990, takes a different approach. It grants a limited, non-exclusive, royalty-free license for use of the format in computer software, and it asks that software using GIF acknowledge CompuServe’s ownership of the format and its service mark.
The same document reserves the authority to define, alter or modify the format to CompuServe Incorporated. You can read both clauses in the GIF89a specification, and the license terms are as of that 1990 document.
How to choose between PNG and GIF
Work through these steps in order and stop at the first one that settles your choice:
- Do you need exact pixels? Choose PNG, because its compression is lossless.
- Do you need see-through areas? PNG has an optional alpha channel built into its specification.
- Will the image appear on a web page? PNG is designed for online viewing and is fully streamable with a progressive display option, per the W3C PNG specification.
- Do you need animation? Check whether your destination supports image/apng, and confirm GIF’s behavior in the full GIF89a text.
If your image is a photograph, the comparison of png vs jpg is the next one to read. Once you settle on PNG, the guide to png-8 vs png-24 covers the variants within the format.
This site is independent and has no affiliation with any software vendor, format body or tool maker. No tool is named or promoted here, and nothing on this page is sponsored.
Frequently asked questions
How do you pronounce PNG?
Show answer
The specification gives the pronunciation as “ping”. It appears in the scope section of the W3C PNG specification.
Can PNG tell if a file was damaged in transit?
Show answer
Yes, it was built with that in mind. The draft says PNG provides full file integrity checking and simple detection of common transmission errors.
Does PNG keep color information?
Show answer
It can. The format is able to store color space data, which helps colors match across different platforms.
Is the PNG specification an international standard?
Show answer
The editor’s draft text says it is intended to become an International Standard but is not yet one. Check the W3C page for any later status before you cite it as a standard.



