Skip to main content

File Formats

What Is PNG? Lossless Compression and Transparency

PNG is a lossless image format that keeps every pixel exactly and supports full transparency. Here is how it grew out of the GIF patent dispute, how its compression works and when it is the right choice.

Author: Hemen Dönüştür Editör EkibiPublished: 8 min read

PNG format guide cover image

PNG (Portable Network Graphics) is an image format that stores pictures without losing any detail and supports full transparency. It has become the standard for screenshots, logos, icons and interface graphics. This article covers why PNG was created, how its compression works, why it sometimes produces very large files, and practical tips for converting PNG images.

How PNG was born: GIF and the LZW patent

In the early 1990s most graphics on the web were GIFs, and GIF used the LZW compression algorithm, which was patented by Unisys. According to Greg Roelofs's history of the format, the licensing agreement between CompuServe and Unisys was quietly announced on 28 December 1994, raising the prospect of license fees for software that wrote GIF files. After the reaction on Usenet, Thomas Boutell posted the first draft of a patent-free format, then called "PBF", on 4 January 1995. The name "PNG" was proposed on 6 January and adopted in Draft 5 on 23 January 1995. The specification was frozen with Draft 9 on 7 March 1995.

The W3C published PNG as a Recommendation on 1 October 1996, and according to the Library of Congress the same text was published by the IETF as RFC 2083 in January 1997. A second edition incorporating the errata followed on 10 November 2003 and became the international standard ISO/IEC 15948. The W3C PNG Third Edition, published on 24 June 2025, brought animated PNG (APNG), the cICP chunk for HDR signaling and the eXIf chunk for EXIF data into the official specification.

How PNG compression works

PNG is lossless: the pixels you get when you open the file are bit for bit the pixels that were saved. The file is made smaller in two stages.

1. Row filters

Before compression, each row of pixels goes through a filter. Instead of the pixel value itself, the filter stores the difference from its neighbors, and in flat or smooth areas those differences are close to zero, so they compress much better. The specification defines five filter types: None, Sub (the pixel to the left), Up (the pixel above), Average (the mean of left and above) and Paeth (a prediction from the left, upper and upper-left pixels). An encoder can choose a different filter for every row.

2. DEFLATE

The filtered data is compressed with DEFLATE, the same algorithm used in ZIP files, and stored in zlib format inside IDAT chunks. It is the only compression method the specification defines, and it uses a sliding window of at most 32 KB. Different programs produce PNGs of different sizes from the same image because they spend more or less effort on filter choice and DEFLATE settings; the image itself is identical.

Chunk structure

A PNG file starts with an 8-byte signature followed by chunks: IHDR for the header, IDAT for image data and IEND to close the file. Optional chunks can hold a color profile (iCCP), gamma (gAMA), text (tEXt, iTXt) and simple transparency (tRNS).

Color types, bit depth and transparency

PNG supports grayscale, palette (indexed) and truecolor images. According to the Library of Congress, sample depths range from 1 to 16 bits; typical RGB images use 8 bits per channel (24-bit), and 16 bits per channel (48-bit) when needed. An optional alpha channel stores a separate transparency value for every pixel. This is far more flexible than GIF's simple on/off transparency: shadows, soft edges and semi-transparent layers look right.

Optional Adam7 interlacing lets an image appear coarse first and then sharpen while it loads, but it usually makes the file larger.

Palette PNG and color reduction

In a palette (indexed) PNG, each pixel stores an index into a palette of up to 256 entries instead of the color itself. Logos, icons and flat illustrations with few colors fit into very small files this way. Palette PNGs can also give palette entries individual transparency values through the tRNS chunk, so unlike GIF, semi-transparent palette colors are possible.

Reducing a photo or gradient to a palette PNG, however, causes color banding and dithering patterns. Color reduction is therefore a preprocessing step to choose according to the type of image; the PNG format itself stays lossless.

How widely is PNG used?

W3Techs data from October 2026 shows PNG on 74.9% of the websites it monitors, which makes it the most widely used image format on websites. According to the HTTP Archive Web Almanac 2024, 28.4% of images on mobile pages are PNG, second only to JPEG (32.4%). The same report puts the median PNG at 3.8 bits per pixel, against 2.0 for JPEG and 1.3 for WebP. PNG's reach on websites comes largely from logos and icons that need transparency; serving large photos as PNG makes pages needlessly heavy.

When to use PNG and when to choose something else

ContentRecommendation
Screenshots, interfaces, graphics with textPNG (or lossless WebP)
Logos and icons with a transparent backgroundPNG; SVG if you have a vector source
PhotographsJPG, WebP or AVIF; PNG is needlessly large
Working copies you will keep editingPNG; no loss builds up when you save again
Photo-like images with transparency for the webWebP or AVIF; they keep transparency and shrink the file

Google's WebP page states that lossless WebP images are 26% smaller than PNGs. That makes WebP a good alternative for graphics shown in a browser, although PNG still has wider compatibility and virtually every program can open it.

Common problems

Why is my PNG so large?

The most common reason is a photograph saved as PNG. Noise and fine detail in photos do not compress well losslessly, so the same picture can be several times smaller as JPG or WebP. For screenshots, file size grows directly with resolution.

Converting JPG to PNG did not improve quality

PNG preserves the pixels as they are at the moment of saving. The losses and block artifacts from JPG compression are already part of the image before conversion, and PNG keeps them exactly too.

Transparency disappeared after converting to JPG

JPG has no alpha channel. During conversion, transparent pixels are filled with a solid color; if you do not choose one, the program's default (usually white or black) is used.

Colors look different

PNG can carry a color profile and gamma information. Programs that interpret this differently may show slightly different colors. Using sRGB for images meant for the web is the safest approach.

Tips for converting PNG

  • Shrink photo-like PNGs. When converting PNG to JPG the default quality is 90; transparent areas are filled with white by default, and you can choose another background color.
  • To keep transparency, convert PNG to WebP or PNG to AVIF; both formats store an alpha channel. If every pixel must stay exactly the same in WebP, tick "Lossless WebP"; the file may grow.
  • Shrinking a PNG while keeping it a PNG has limited room: as long as the image stays the same, the gain only comes from trying better filters and compression. Our image compressor converts still PNGs to WebP by default; if you want to keep PNG, the extra PNG optimization option tries to make the file smaller without changing a single pixel.
  • Need an icon? The PNG to ICO converter packs a square icon at 16, 32 and 48 pixels (and larger sizes if the image is big enough) into one file.
  • These conversions run in your browser, so your files never leave your device. EXIF and location data are not written to the output.

Frequently Asked Questions

Is PNG lossy or lossless?

PNG is lossless. No matter how many times you open and save the file, the pixels do not change. What some tools call "lossy PNG" is reducing the number of colors before saving to produce a palette PNG; the loss happens in that preprocessing step, not in the format.

Does PNG support animation?

Basic PNG does not. The APNG extension adds animation, and it became part of the specification with the W3C PNG Third Edition. According to MDN all current browsers display APNG, but many image editors only open its first frame.

What do PNG-8 and PNG-24 mean?

These names are not in the specification; they are shorthand used by software. PNG-8 usually means a palette PNG with up to 256 colors, PNG-24 a truecolor PNG with 24 bits per pixel, and PNG-32 an RGBA PNG with an alpha channel.

Should I use PNG or WebP?

If the image will be shown on a web page, WebP usually gives a smaller file and keeps transparency too. If you will edit the image in other programs, send it to someone or archive it, PNG offers wider compatibility.

Is PNG suitable for print?

Quality-wise yes, because it is lossless, but PNG does not support the CMYK color model. Professional print workflows usually prefer TIFF or PDF.

Sources

Related converters

All articles