JPEG

Also known as: Joint Photographic Experts Group

On this page 7

JPEG is a lossy image compression standard and the file format built on it, named after the Joint Photographic Experts Group that defined it in the early 1990s. In photography and image processing, JPEG is the format in which cameras, phones and editing software deliver a finished, rendered photograph: demosaiced, white balanced, tone mapped, sharpened and reduced to 8 bits per channel.

Its success rests on a simple trade-off: JPEG discards detail that the human eye notices least, so a typical photograph shrinks to roughly one-tenth of its uncompressed size with little visible change. The cost is that the file is no longer suitable for heavy editing, unlike a RAW file that keeps the original sensor data.

How JPEG compression works

Baseline JPEG compression runs as a fixed sequence of steps, and only one of them actually throws information away. First the image is converted from RGB to YCbCr color space, which separates brightness (luma) from color (chroma). Because human vision resolves brightness detail better than color detail, the chroma channels are usually stored at reduced resolution, a step called chroma subsampling.

The image is then divided into 8×8 pixel blocks, and each block is transformed with the discrete cosine transform (DCT) into 64 frequency coefficients. A quantization table divides these coefficients and rounds the results, which reduces fine high-frequency detail to zero. Finally, lossless Huffman entropy coding packs the remaining values efficiently.

The table below lists each stage and whether it loses data.

StagePurposeData loss
Color conversionSeparates luma from chromaMinimal rounding only
Chroma subsamplingReduces color resolutionYes, color detail
Discrete cosine transformExpresses blocks as frequenciesNo
QuantizationRounds frequency coefficientsYes, the main loss
Entropy codingPacks data with Huffman codesNo
Stages of baseline JPEG encoding

Quality settings and chroma subsampling

The quality setting in an encoder does not appear in the file itself; it simply scales the quantization tables. Higher values use smaller divisors, keep more coefficients and produce larger files. The relationship is strongly nonlinear: the step from quality 90 to 100 can nearly double file size while adding detail few viewers can see.

Quality rangeRelative file sizeTypical use
95-100Very largeArchival masters, print handoff
85-92LargeCamera fine mode, client delivery
70-84MediumWeb galleries and portfolios
50-69SmallThumbnails and previews
Below 50Very smallOnly where bandwidth is critical
Typical quality ranges and their use

Subsampling is written as a ratio. 4:4:4 keeps full color resolution, 4:2:2 halves it horizontally, and 4:2:0 halves it in both directions, which is the default in most cameras and web encoders. Subsampling is harmless for most photographs but can blur saturated red edges and fine colored text.

JPEG compared with RAW and modern formats

JPEG competes with formats that keep more data or compress more efficiently, and the right choice depends on where the file sits in the workflow. RAW belongs at capture and editing; JPEG and its successors belong at delivery.

FormatCompressionBit depthMain strength
JPEGLossy8-bitUniversal compatibility
RAWLossless or lightly lossy12-14 bitMaximum editing latitude
PNGLossless8 or 16 bitGraphics and transparency
HEICLossy, HEVC based8-10 bitSmaller files on phones
WebPLossy or lossless8-bitEfficient web delivery
AVIFLossy, AV1 based8-12 bitHigh efficiency and HDR
JPEG and related image formats

Newer formats such as AVIF and HEIC typically reach similar visual quality at 30-50 percent smaller sizes, and they support wider bit depths. JPEG remains dominant because every browser, operating system, printer and photo lab reads it without conversion. Extensions such as JPEG XL promise lossless recompression of existing JPEG files, but support is still uneven.

Metadata, color and file structure

A JPEG file is a sequence of marker segments that hold the compressed image together with descriptive data. The EXIF segment records camera settings, date, orientation and often GPS coordinates; an embedded ICC color profile such as sRGB or Adobe RGB tells software how to interpret the color values.

A missing or ignored profile is a common cause of dull or oversaturated colors when an Adobe RGB file is displayed as if it were sRGB. For web delivery, converting to sRGB before export is the safe default. Removing location data before publishing is also a basic privacy precaution.

Two encoding modes affect how a file loads. Baseline JPEG draws the image from top to bottom as data arrives, while progressive JPEG sends a coarse version of the whole frame first and refines it in later passes. Progressive files are often slightly smaller and feel faster on slow connections, so many web optimization tools choose them by default.

Artifacts, generation loss and common mistakes

Strong quantization produces characteristic compression artifacts. Visible block edges, ringing around sharp contrast and stepped gradients all come from the 8×8 structure and the rounding of coefficients.

ArtifactCausePrevention
BlockingCoarse quantization of 8×8 blocksRaise the quality setting
RingingLost high frequencies near edgesAvoid heavy sharpening before export
Banding8-bit depth and smoothing of gradientsAdd slight grain, edit in 16-bit
Color bleedingChroma subsamplingExport with 4:4:4 when color edges matter
Generation lossRepeated decode and re-encodeEdit the master, export once
JPEG artifacts and how to avoid them
  • Do not use JPEG as an editing master; save layered or 16-bit working files instead.
  • Avoid opening, editing and saving the same JPEG repeatedly, because each save quantizes again.
  • Lossless operations such as 90-degree rotation can be done without recompression in suitable tools.
  • Shooting RAW plus JPEG gives an immediate shareable file and a full-quality original.

A plain-language summary

JPEG is the most common way to save and share photos. It makes pictures much smaller by quietly leaving out tiny details and color nuances that people rarely notice, a bit like summarizing a long letter while keeping its meaning.

The summary works well for viewing, but each new save loses a little more. For that reason photographers keep an original and use JPEG as the final copy to share.

An example from practice

A real estate photographer shoots a house interior in RAW, edits the 40 selected frames in 16-bit, and must deliver them to an agency whose listing platform accepts files up to 2 MB. Exporting at full resolution with quality 100 produces files of about 12 MB, far above the limit.

The photographer resizes the images to 3000 pixels on the long edge, converts them to sRGB, removes GPS data from the EXIF block and exports at quality 82 with 4:2:0 subsampling. Each file lands between 1.1 and 1.6 MB, loads quickly on the listing site, and shows no visible blocking even on smooth white ceilings, while the RAW originals stay archived for any later print request.