Format Explainer
Is JPEG Lossless or Lossy? How JPEG Compression Actually Works
Updated: March 2026
Short Answer: JPEG is LOSSY.
JPEG (also written as JPG) is a lossy compression format. Every time you save an image as JPEG, some visual information is permanently discarded to reduce file size. There is a rarely-used lossless JPEG variant (JPEG-LS), but the standard JPEG format that you encounter in everyday use is always lossy. This is by design, and it is the reason JPEG files are so much smaller than lossless formats like PNG.
How JPEG Compression Works: Step by Step
Understanding how JPEG compression works helps explain why it's lossy and why it works so well for photographs. The JPEG encoding pipeline has several distinct stages, each serving a specific purpose. Here is what happens when you save an image as JPEG:
Step 1: Color Space Conversion (RGB to YCbCr)
The image is converted from RGB (Red, Green, Blue) to YCbCr color space, where Y represents brightness (luminance) and Cb/Cr represent color information (chrominance). This separation is important because human eyes are much more sensitive to brightness differences than color differences. By isolating these components, JPEG can compress color data more aggressively without noticeable quality loss.
Step 2: Chroma Subsampling
The color channels (Cb and Cr) are typically reduced to half resolution in both dimensions (called 4:2:0 subsampling). This immediately cuts the color data to one quarter of its original size. Because human vision has relatively low color resolution, this massive reduction is barely perceptible. This step alone is responsible for a significant portion of JPEG's compression. Some high-quality JPEG saves use 4:4:4 (no subsampling) to preserve full color resolution.
Step 3: Discrete Cosine Transform (DCT)
The image is divided into 8x8 pixel blocks, and each block is transformed from the spatial domain (pixel values) into the frequency domain using the DCT. This converts the block into a set of frequency coefficients representing everything from the block's average color (low frequency) to fine detail and sharp edges (high frequency). The DCT itself does not lose any data. It is a mathematically reversible transformation. The loss comes in the next step.
Step 4: Quantization (WHERE DATA IS LOST)
This is the critical lossy step. The frequency coefficients from the DCT are divided by values from a quantization table and rounded to the nearest integer. High-frequency coefficients (fine details) are divided by larger numbers, causing many of them to round to zero. These zeros represent detail that is permanently discarded. The quality setting you choose when saving a JPEG directly controls how aggressive this quantization is. Lower quality means larger divisors, more zeros, and more data lost. Higher quality means smaller divisors, fewer zeros, and less data lost.
Step 5: Entropy Coding (Huffman/Arithmetic)
Finally, the quantized coefficients (now containing many zeros) are encoded using lossless entropy coding, typically Huffman coding. This step is completely lossless and simply represents the data as compactly as possible. The many zeros produced by quantization compress extremely well, which is why aggressive quantization leads to smaller files.
JPEG Quality Settings: What They Actually Control
When you save a JPEG and choose a quality level (typically 1-100), you are controlling the quantization tables used in Step 4 above. Higher quality means less aggressive quantization, which preserves more detail but produces larger files. Lower quality means more aggressive quantization, which discards more detail for smaller files. The relationship between quality number and file size is not linear. Going from quality 95 to 85 might cut file size in half with barely any visible difference, while going from quality 30 to 20 saves relatively little additional space but looks noticeably worse.
| Quality Level | Typical File Size | Visual Quality | Best Use |
|---|---|---|---|
| 95-100 | Large (500KB-2MB) | Near-perfect | Archiving, print |
| 80-90 | Medium (100-400KB) | Excellent | Web (recommended) |
| 60-79 | Small (50-150KB) | Good | Thumbnails, previews |
| 40-59 | Very small (20-80KB) | Acceptable | Low-bandwidth delivery |
| 1-39 | Tiny (5-30KB) | Poor, visible artifacts | Not recommended |
File sizes are approximate for a typical 1920x1080 photograph
The JPEG Lossless Variant: JPEG-LS
It is worth mentioning that a lossless JPEG mode does technically exist. JPEG-LS (Lossless JPEG) was defined in the JPEG standard and uses a completely different algorithm based on predictive coding rather than DCT. However, JPEG-LS has seen almost zero adoption in consumer software. When people say "JPEG," they invariably mean the standard lossy DCT-based format. No mainstream image editor, web browser, or operating system uses JPEG-LS by default. If you need lossless compression, PNG, WebP lossless, or TIFF are far more practical and widely supported choices. There is also JPEG 2000, which supports both lossy and lossless modes using wavelet transforms, but it too has failed to achieve mainstream adoption outside of specialized fields like medical imaging and digital cinema.
Why Lossy Compression Works So Well for Photos
JPEG's lossy compression is specifically designed around the human visual system, and it exploits several well-understood perceptual limitations. First, human eyes are far more sensitive to changes in brightness than in color, which is why chroma subsampling works so effectively. Second, we are poor at perceiving high-frequency spatial details (very fine textures and subtle gradients), especially in complex scenes. Photographs are full of natural noise, texture variation, and complex detail where the loss of high-frequency data is masked by the existing visual complexity. This is why JPEG works brilliantly for photos but poorly for graphics with sharp edges, flat colors, and text, where every pixel is deliberate and artifacts are immediately visible.
The Problem of Cumulative Loss (Re-saving)
One of the most important things to understand about JPEG is that quality degrades every time you open and re-save the file. Each save cycle runs the image through the full compression pipeline again, and each cycle's quantization step discards a bit more data. After just a few re-saves at moderate quality, the cumulative degradation becomes clearly visible: colors shift, edges become blocky, and "mosquito noise" artifacts appear around high-contrast boundaries. This effect is called generation loss. To avoid it, follow these best practices: always edit from the original file or a lossless copy, never from a JPEG that has already been compressed. Save your working files as PNG or TIFF. Only export to JPEG as the very last step, and do it once. If you need to make changes later, go back to your lossless original, make the edit, and export a fresh JPEG.
Best Practice: Keep your master images in PNG or TIFF format. Export to JPEG only once as the final step. If you need to edit later, always go back to the lossless master, not the JPEG export.
Frequently Asked Questions
Q: Does saving a JPEG at quality 100 make it lossless?
A: No. Even at quality 100, JPEG still applies its lossy compression pipeline including chroma subsampling (in most implementations) and quantization (though with minimal rounding at quality 100). The quality loss at 100 is extremely small and usually imperceptible, but it is technically not lossless. The file will not be bit-identical to the original. If you need true lossless, use PNG.
Q: How many times can I re-save a JPEG before quality degrades noticeably?
A: It depends on the quality setting. At quality 95-100, you might re-save 5-10 times before noticing degradation. At quality 70-80, degradation becomes visible after 3-5 re-saves. At quality 50 or below, even a single re-save may introduce noticeable additional artifacts. The safest approach is to never re-save a JPEG; always work from a lossless original.
Q: Why do JPEG images look blocky at low quality?
A: The blockiness comes from JPEG's 8x8 pixel block structure. At low quality settings, the quantization step zeroes out most frequency coefficients in each block, leaving only the average color and very coarse detail. Neighboring blocks end up with slightly different average values, creating visible block boundaries. This is JPEG's most recognizable artifact.
Q: Should I convert my JPEGs to PNG for better quality?
A: Converting to PNG will not improve quality since the data lost during JPEG compression cannot be recovered. However, saving as PNG does prevent further degradation if you plan to edit the image again. The resulting PNG file will be significantly larger than the JPEG but will preserve the current state of the image without any additional loss.
Need to convert JPEG to a lossless format?
Convert JPG to PNG Free