What's the largest possible PNG?

, updated (originally posted )

The maximum dimension of a PNG is 231−1 pixels. That means that a PNG can be at most ~2.1 billion pixels wide and ~2.1 billion pixels tall.

This is because the width and height are stored in “PNG four-byte unsigned integers” which are between 0 and 231−1.

However, PNGs have no maximum file size. You can embed an infinite amount of metadata in PNGs—even a 1×1 image could be terabytes large if it has enough metadata inside.

In practice, many PNG decoders impose smaller limits than the spec. For example, libpng imposes a default maximum width and height of 1 million pixels.

See also: the smallest possible PNG.