PNG File Format

Portable Network Graphics

Last updated: February 2026

Overview & History

The PNG (Portable Network Graphics) format was developed in 1996 as a patent-free alternative to the GIF format. The creation of PNG was directly triggered by the "GIF controversy" of 1994-1995, when Unisys began enforcing its patent on the LZW compression algorithm used by GIF. This sparked outrage in the early web community, and a group of developers led by Thomas Boutell created PNG as an open, unencumbered replacement that offered significant technical improvements over GIF.

PNG was published as a W3C Recommendation in 1996 and later standardized as ISO/IEC 15948 in 2004. Unlike GIF's 256-color limitation, PNG supported true color (24-bit) and even 48-bit color depths, along with a full 8-bit alpha channel for smooth transparency. These capabilities made PNG far superior for web graphics, though GIF retained its niche for simple animations — a feature PNG deliberately omitted to keep the specification focused.

Today, PNG is the standard format for web graphics that require transparency or pixel-perfect reproduction. It is the preferred format for screenshots, logos, icons, UI elements, and any image with text or sharp edges. Users frequently work with PNG in conversion workflows — converting JPG to PNG when transparency is needed, converting HEIC to PNG from iPhone photos, or converting PNG to PDF for document inclusion. The format's lossless nature makes it essential for image editing workflows where preserving quality across multiple edits is critical.

Technical Overview

PNG uses a lossless compression pipeline built on the DEFLATE algorithm (the same algorithm used in ZIP files). The compression process begins with filtering — each row of pixels is preprocessed using one of five filter types (None, Sub, Up, Average, Paeth) that exploit correlations between neighboring pixels to make the data more compressible. The filter selection can vary per row, and optimal selection significantly impacts compression ratio.

The filtered data is then compressed using DEFLATE, which combines LZ77 (sliding window dictionary compression) with Huffman coding. This two-stage approach finds repeated byte patterns and encodes them as back-references, then applies statistical coding to the result. PNG stores the compressed data in IDAT chunks, and multiple IDAT chunks can be used to allow streaming compression and decompression.

A PNG file is organized as a sequence of typed chunks, each with a 4-byte type code, length, data, and CRC32 checksum. Required chunks include IHDR (image header with dimensions, bit depth, color type), IDAT (compressed image data), and IEND (image end marker). Optional chunks provide metadata (tEXt, iTXt), color management (iCCP, gAMA, cHRM, sRGB), transparency (tRNS), and suggested display parameters (pHYs). The format supports four color types: grayscale, truecolor (RGB), indexed color (palette), and each with optional alpha channel. For converting PNG to JPG, the alpha channel must be composited against a background color since JPEG doesn't support transparency. PNG also supports interlacing via Adam7, which arranges pixels in seven passes for progressive rendering — useful for web image optimization where perceived loading speed matters.

Pros & Cons

Advantages

  • Lossless compression preserves every pixel perfectly
  • Full alpha channel support for smooth transparency
  • Supports true color (24-bit) and deep color (48-bit)
  • Patent-free and open standard (ISO/IEC 15948)
  • Excellent for text, line art, screenshots, and sharp-edged graphics
  • No quality degradation from multiple edits and re-saves

Limitations

  • Significantly larger file sizes than JPEG for photographs
  • No native animation support (APNG is a non-standard extension)
  • No CMYK color space support for print workflows
  • Compression is slower than JPEG encoding
  • Not ideal for continuous-tone photographic content

Common Uses

  • Web graphics with transparency (logos, icons, UI elements)
  • Screenshots and screen recordings (frames)
  • Digital art and illustrations
  • Graphics with text overlays
  • App and game assets requiring transparency
  • Technical diagrams and charts
  • Image editing intermediate saves (lossless)
  • Favicon and social media profile images

Related Guides

Technical Details

Full Name
Portable Network Graphics
MIME Type
image/png
Type
Image
Compression
Lossless
Max File Size
Unlimited (practical ~2GB)
Color Space
sRGB, Grayscale
Bit Depth
8-bit, 16-bit
Transparency
Yes
Editable
Yes
Layers
No

Best For

  • Graphics with transparency
  • Screenshots
  • Logos and icons
  • Text-heavy images