Lossless compression is a data-compression method in which the compressed representation can be decompressed to reproduce the original data exactly. No information is deliberately discarded, and the output after decompression is identical to the input according to the relevant representation. In digital imaging, PNG is a well-known lossless format, and WebP and AVIF can also operate in lossless modes.
Lossless compression is particularly important when exact pixel values must be preserved, such as for technical drawings, screenshots, icons, source graphics, archival material and intermediate processing stages. It can reduce file size by exploiting redundancy rather than by removing visually less important information. Because every piece of information must remain recoverable, lossless compression generally cannot achieve the very high compression ratios possible with carefully tuned lossy image codecs on complex photographs.
Lossless compression works by finding predictable patterns, repeated sequences or statistical regularities and representing them more efficiently. If an image contains long runs of identical pixels, a run-length encoding method can represent the run using a value and count rather than storing the value repeatedly. Dictionary-based methods identify repeated sequences and replace subsequent occurrences with references to previously established patterns. Entropy coding assigns compact binary codes to frequently occurring symbols and longer codes to less frequent symbols.
Predictive methods store differences between neighbouring values rather than absolute values when those differences are statistically smaller or more repetitive. Modern image formats frequently combine several such techniques. The crucial property is that the decoder can reverse every transformation and recover the original data exactly.
PNG demonstrates how lossless image compression can exploit spatial structure. Before compression, PNG can apply one of several filters to each scanline. These filters calculate residual values based on neighbouring pixels so that smooth images often produce small or repetitive residuals. DEFLATE then compresses the resulting data using dictionary matching and Huffman coding. None of these operations intentionally removes information. When the PNG is decoded, the inverse filter reconstructs the exact pixel values that existed before filtering.
The effectiveness of this process depends on image content. A screenshot with large uniform regions and repeated structures may compress very well, whereas a noisy photograph may remain relatively large because its pixel values are less predictable and contain less redundancy that lossless algorithms can exploit.
Lossless compression is fundamentally different from lossy compression because its quality-versus-size trade-off has a different boundary. With lossless compression, changing encoder settings can influence compression efficiency and computational requirements but cannot intentionally reduce the fidelity of the decoded data. With lossy compression, smaller files can normally be achieved by allowing greater information loss. This makes lossless formats attractive for master files, source assets and exact reproduction, while lossy formats are often more efficient for final distribution of photographs.
The distinction concerns reversibility rather than whether the file is compressed. A file can be compressed and still be lossless, and a file can be extremely large while also being lossless. Conversely, a lossy file can have very high visual quality while remaining mathematically different from its source.
Lossless compression is especially valuable in workflows where tiny changes matter. A screenshot of software documentation may contain small text whose exact edges need to remain sharp. A technical diagram may use precise lines and colour boundaries that become distorted by lossy compression. A computer-generated graphic may contain flat regions where lossy codecs produce ringing or colour variation.
Scientific and medical imagery can have measurement significance that makes arbitrary information loss inappropriate, although the precise requirements depend on the domain and data type. In editing workflows, lossless formats can also prevent cumulative degradation across repeated saves. The choice of lossless storage does not automatically guarantee that an entire workflow is lossless, however, because images may have undergone earlier transformations, colour conversions, resizing or other irreversible operations before being saved in a lossless format.
Lossless compression is governed by the information content of the source. A highly repetitive image can be compressed considerably because its data contains substantial redundancy. A random or noisy image may resist compression because there are fewer predictable patterns. This explains why two images with identical dimensions and bit depth can have dramatically different lossless file sizes. An image of a single colour can be represented extremely compactly, while a sensor-noisy photograph may require substantially more data.
Compression algorithms cannot generally reduce arbitrary information indefinitely because the output must retain enough information to reconstruct every original value. This is related to information-theoretic limits: for a given source distribution, there is a lower bound on the average number of bits required for exact representation.
Lossless compression also plays an important role in archival and production workflows. A high-quality source can be retained in a lossless format while smaller lossy derivatives are generated for web or mobile delivery. This separation allows the original to remain available for future editing, republishing or conversion to newer formats. Lossless formats are also useful when a file will pass through multiple processing stages and exact intermediate values are desirable. However, lossless storage can require considerably more disk space than lossy delivery formats, particularly for large photographic collections. Organisations therefore often combine lossless masters with compressed derivatives and use storage tiers, deduplication and other data-management techniques to balance preservation requirements against cost.
Lossless compression is therefore the exact-reconstruction approach to data compression: it reduces the number of bits needed to store information without changing the information itself. Image formats such as PNG use prediction and dictionary or entropy-based techniques to exploit redundancy, while other formats employ different combinations of reversible transformations. Its major strengths are exact fidelity, repeatable decoding and suitability for source assets, graphics, screenshots and archival workflows.
Its principal limitation is that complex images often cannot be reduced as dramatically as they can with lossy methods. Lossless compression should consequently be selected when preserving exact image information is more important than achieving the smallest possible file, while lossy compression is generally appropriate when a controlled amount of irreversible change is acceptable in exchange for substantially smaller files.