What Is JPEG? Understanding the Image File Format
What JPEG is, how its lossy compression works, when to use it for photos and snapshots, and its limits: no transparency, quality loss and metadata.
What JPEG is
JPEG is a widely used file format for photographs and other images with smooth tones. It uses lossy compression, which means some visual detail is discarded when the image is saved so that the file becomes much smaller. Files usually end in .jpg or .jpeg, and both extensions mean the same format. The name comes from the Joint Photographic Experts Group, the committee that created the standard. It was first published in 1992.
JPEG is the usual choice for a photo that needs to be small enough to share, upload or store in large numbers while still looking good on screen. It is a poor choice when you need exact pixels, crisp text or a transparent background.
How JPEG compression works
The JPEG image format does not store every pixel exactly. A simplified version of what an encoder does:
- Color conversion: RGB pixels are converted into one brightness channel and two color channels. Human vision notices brightness detail more than color detail.
- Chroma subsampling (optional): the color channels can be stored at a lower resolution than brightness. In most photos this saves space with little visible change.
- Block transform: the image is split into 8×8 pixel blocks. Each block is described as a mix of patterns, from smooth areas to fine detail, using a discrete cosine transform.
- Quantization: values for fine detail are rounded more coarsely than values for broad shapes. Most of the lost information is lost here, and the quality setting controls how much is rounded away.
- Entropy coding: the remaining values are packed losslessly to shrink the file further.
Many cameras and image editors let you pick a quality level or a preset such as fine or normal. The numeric scale is not standardized. A setting of 80 in one program will not necessarily match 80 in another, so compare the results by eye rather than by the number.
A JPEG file also contains a header that records the pixel dimensions, and it can carry metadata. Cameras and phones commonly add EXIF data, such as capture date, device model and exposure settings. Photo orientation is often stored as a metadata tag instead of actually rotating the pixels. Software that ignores this tag can show the image sideways.
Baseline JPEG loads from top to bottom. Progressive JPEG stores a rough version of the whole image first and then refines it. Both are widely supported. Standard JPEG stores 8 bits per color channel. JPEG 2000 and JPEG XL are separate formats, despite their similar names.
When to use JPEG and when to avoid it
- Photos from cameras, phones and webcams: JPEG is a good fit, because natural scenes hide compression well.
- Screenshots, text, diagrams and logos: a lossless format such as PNG usually works better. JPEG tends to blur or add halos around sharp edges and lettering.
- Images that need a transparent background: JPEG has no transparency (alpha channel). Use PNG, WebP or another format that supports it.
- Images you will edit several times: keep a lossless master or the camera's raw file, and export to JPEG only as the final step.
- Uploads with a size limit: lower the pixel dimensions first, then reduce quality if the file is still too large.
When you resize, keep the original aspect ratio unless you mean to change it. Stretching an image to fit new dimensions distorts faces and objects. Cropping is the cleaner way to get a different shape. Reducing pixel dimensions usually shrinks the file more predictably than lowering quality alone, and it avoids visible artifacts.
Some camera apps, webcam test pages and video call tools can save snapshots as JPEG. The format used, the save location and whether the image is processed on your device or uploaded all depend on the specific tool. Check its settings or documentation rather than assuming.
Limits and related questions
Each time a JPEG is opened, edited and saved again, it is recompressed and the artifacts build up. This is called generation loss. Some tools can rotate in 90-degree steps or crop without recompressing, but not all of them do, so check how your software handles it.
Common artifacts include blockiness along the 8×8 grid, ringing or halos near sharp edges, and banding in smooth gradients such as skies. They become more visible at lower quality settings and after repeated saves.
Is JPG different from JPEG? No. The three-letter extension dates from older systems that limited file extensions to three characters. Changing a file's extension does not convert it to another format. Real conversion requires re-encoding the image.
Quality and size are independent. Lowering the quality setting does not change the pixel dimensions, and resizing does not change the quality setting. The standard allows up to 65,535 pixels on each side, though individual programs and services may set lower limits.
Metadata can reveal more than the picture shows, including GPS location when the device recorded it. Some editors and sharing services remove EXIF data and others keep it. Check a file's metadata before sending it, rather than relying on a platform to strip it.