Tech

Why JPEG Loses Quality: Artifacts, 8×8 Blocks and Compression Settings

You open a photo and it's covered in tiny squares, there's a murky halo around the text, and a clear sky has turned into stripes. It isn't a corrupt file or a bad camera — it's how JPEG compression works. Let's walk through exactly what the format throws away from your image, why you can see it, and how to set up saving so the artifacts never show.

Close-up of a camera's mode dial — capture and compression settings decide how much detail survives into a JPEG file
JPEG quality isn't on/off — it's a slider. Once you know what sits behind it, you control it on purpose. Photo: Pexels

The short answer: why the image falls apart

JPEG is a lossy compression format. Unlike PNG, which keeps every pixel exactly, JPEG deliberately throws away part of the information in an image to make the file smaller. The bet is simple: the human eye misses a lot, so why store what nobody can see?

The catch is that the eye misses those losses only up to a point. Push the compression harder and what was thrown away starts to show: instead of a smooth picture you get squares, murky halos and stripes. These are compression artifacts. They don't "decay over time" or "glitch out" — they are baked into the file the moment you save, and the only way to undo them is to re-save from the original.

The key idea

JPEG doesn't "lose quality on its own." It gives up exactly as much quality as you allow it to with the compression slider. This whole article is about how it does that, and where the line between "invisible" and "now you can see it" actually falls.

Step 1: JPEG cuts the image into 8×8 blocks

The first thing a JPEG encoder does is split the image into a grid of 8×8-pixel squares. Each block is then processed completely independently of its neighbours. That's the crucial detail: JPEG never sees the picture as a whole — it sees thousands of little squares and compresses them one at a time.

Inside each block it runs a piece of math called the Discrete Cosine Transform (DCT). It sounds intimidating, but the idea is simple. The DCT describes a block not as 64 separate pixels, but as a sum of "waves" of different frequency: gentle shifts in brightness are "low frequencies," while tiny sharp details are "high frequencies." In effect, the format translates the picture from the language of "here are the pixel values" into "here are the waves it's made of."

An analogy

Think of an 8×8 block as a musical chord, and the DCT as splitting it into individual notes. Low frequencies are the bass (the block's overall tone); high frequencies are the faint upper harmonics (the fine detail). Nothing is lost yet — it's just another way to write down the same sound.

Step 2: what gets discarded — high frequencies

The DCT itself is reversible and loses nothing. The losses begin at the next step — quantization. Here JPEG divides every DCT coefficient by a number from a special table and rounds the result. Small values — and those are first and foremost the high frequencies, the fine detail — simply become zeros after dividing and rounding. And those you cannot get back.

Why the high frequencies specifically? Because the eye is least sensitive to them: slightly coarsening the fine texture of grass or skin is something we barely notice, whereas overall shape and color we catch instantly. JPEG exploits exactly this: it sacrifices the detail we "won't miss" and preserves what jumps out. That's also why the format is so good for photos and so bad for text — more on that below.

A workstation with histograms and color scopes — how professionals watch what happens to an image's brightness and color
Histograms and scopes reveal the spread of brightness and color. It's the smooth gradients versus the sharp edges that decide what JPEG throws out. Photo: Pexels

The strength of quantization isn't fixed. It's set by the quality parameter (its own chapter below): the lower it is, the "coarser" the table, the more coefficients are zeroed out and the more detail is lost. At quality 95 only the most imperceptible crumbs go; at quality 30 you lose half of what made the picture sharp.

8×8compression block size
64DCT coefficients per block
1992year the JPEG standard shipped

The four faces of JPEG artifacts

When compression goes too far, the losses surface as recognizable defects. Once you can tell them apart, you instantly know what went wrong — and what to do about it.

ArtifactWhat it looks likeWhere it shows most
BlockingA visible grid of 8×8 squaresSky, skin, smooth backgrounds
RingingLight/dark "ripples" along an edgeHigh-contrast borders, text
Mosquito noiseShimmering specks near edgesText, logos, branches on sky
BandingStair-step stripes instead of a gradientSunsets, smooth fills

Blocking is the most recognizable defect. Because each 8×8 block is compressed separately, under heavy compression neighbouring blocks end up with slightly different average brightness and color — and the seams between them show up as a grid. It's most obvious on even areas: clear sky, skin, a studio backdrop.

Ringing appears at sharp, high-contrast edges. To describe a hard transition precisely you need a lot of high frequencies — exactly what JPEG trimmed. So the edge "rings": a light-and-dark ripple forms beside it, like ripples on water. Mosquito noise is the same ripple, but unstable: it lands differently across blocks, so a swarm of specks seems to buzz around a letter or a branch.

Banding is the curse of smooth gradients. A soft color transition (a sunset sky, a blurred background) needs subtle high frequencies; when quantization zeros them out, the smoothness collapses into a few flat stair-step stripes.

Artifacts are irreversible

Once detail is discarded on save, it's no longer in the file — there's nothing to restore. Denoisers and AI upscalers can disguise blocks by softening them or inventing plausible texture, but they don't bring the real lost detail back. The only reliable fix is to take the original and save it at a higher quality.

Color at half resolution: chroma subsampling

There's one more source of loss few people know about — chroma subsampling. Before compressing, JPEG separates the image into brightness (how light a pixel is) and chroma (its color). This isn't arbitrary: the eye is highly sensitive to brightness and much worse at resolving fine detail in color specifically.

JPEG leans on this and stores color at reduced resolution. In the most common mode, 4:2:0, every four brightness pixels share a single color sample — meaning the color information is halved along both axes. On a photo this is almost invisible: brightness stays full. But wherever a sharp boundary between two colors meets — red text on a blue background, a colored interface — the color "bleeds" past the edge, because it's stored more coarsely than the picture itself.

Editing cityscape photos on a laptop — color subsampling is invisible on photos but hurts the sharpness of text and graphics
On real photos, chroma subsampling is barely noticeable. The trouble starts with text and graphics that have sharp colored edges. Photo: Pexels

The quality setting: what to choose

When you save a JPEG, the program asks for a "quality" from 0 to 100. In reality that's a knob for the strength of quantization: 100 throws away almost nothing, 0 throws away everything it can. The important thing is that quality is not linear: between 100 and 90 the difference in file size is enormous while the difference to the eye is near zero. But between 60 and 40 the size barely changes, yet artifacts pile up fast.

90–100
Print, important shots, archiving. Indistinguishable from the original by eye
80–90
The sweet spot for web and social: small files, no visible artifacts
70–80
Saving bandwidth. Artifacts start to show on complex textures
below 70
Visible blocking and ringing. Only when weight matters more than quality

The practical takeaway: for photos, stay in the 80–90 range — the best balance of "light file / no visible loss." Going above 95 is almost pointless: size grows quickly with no meaningful gain. And if you're converting an already-saved JPEG, remember — you can't raise quality after the fact: whatever was discarded in the source is already gone from it.

Setting JPEG to 100 is like carefully storing a photo that's already been torn. Quality is decided at the moment of the first save, not when you copy it.

Generation loss: death by re-saving

Here's the scenario that quietly kills millions of photos. You open a JPEG, nudge the brightness, save. Tomorrow you open it again, crop, save again. And so on, a few times over. Each round the picture gets worse — even if you barely changed anything. This is generation loss.

The reason is that every JPEG save is a brand-new full round of lossy compression. The software re-cuts the image into 8×8 blocks, runs the DCT again and quantizes again, discarding detail. Worse: on re-saving, the block grid often shifts and no longer lines up with the previous one, so the format "damages" even the spots that survived last time. The artifacts aren't overwritten — they accumulate, generation after generation, like photocopying a photocopy of a photocopy.

1

Edit from the original

Keep the source (RAW or the camera's JPEG) and edit a fresh copy of it each time, not the result of the last edit.

2

Work in a lossless format

While editing, keep the file lossless — PNG or TIFF. That way intermediate saves don't pile up artifacts.

3

JPEG once, at the end

Compress to JPEG only for the final version, right before publishing. One compression instead of ten — and the photo stays clean.

Save your photo losslessly — while you still have the original

Planning lots of edits, or need crisp text and graphics? Convert JPEG to PNG: a lossless format won't add a single new artifact across future saves. Free, right in your browser.

Convert JPG to PNG

When JPEG is simply the wrong tool

JPEG is brilliant at exactly the job it was built for — photographs. Smooth tonal transitions, soft textures, no hard outlines: here the loss of high frequencies is invisible, and the file comes out many times lighter than PNG. For camera and phone shots it's the ideal format.

But wherever a picture is made of sharp edges and solid colors, JPEG falls apart — because it discards the very thing that holds such graphics together:

  • Text and screenshots. Letters and lines are pure high frequency. JPEG wraps them in halos and mosquito noise, and the text turns grubby. Use PNG.
  • Logos and graphics with flat fills. Crisp color borders get smeared by both blocking and chroma subsampling.
  • Images with transparency. JPEG can't do it at all — a transparent background turns white. PNG only.
  • Files for further editing. To avoid stacking up generation loss, keep intermediate versions lossless.

If instead you want a newer, compact photo format, look at WebP: at comparable quality it's usually lighter than JPEG — try it in the JPG → WebP converter. And when you need to turn a PNG back into a light JPEG for publishing, PNG → JPG has you covered. The full list of conversions lives on the all formats page.

A simple rule for choosing

A photo with no hard outlines — JPEG (quality 80–90). Text, a screenshot, a logo, transparency, or a file you'll edit later — PNG. This one decision saves more headaches than any denoiser.

A camera lens in close-up — for shots with smooth transitions JPEG remains an excellent choice
For photography, with its smooth transitions, JPEG is still an excellent tool. The point is knowing its limits. Photo: Pexels
JPEG compresses an image in 8×8-pixel squares and throws away the "high frequencies" — the fine, sharp detail — inside each one. The harder the compression, the more detail is gone: neighbouring squares stop matching in brightness and show up as a grid, while sharp edges grow a blurry halo. Those are compression artifacts.
Not fully. Lossy compression is irreversible: the discarded detail is not stored in the file, so there is nothing to bring back. Denoising filters can soften the blocks a little, but they cannot return real sharpness. The only reliable fix is to re-save from the original at a higher quality while the original still exists.
For photos, 80–90 is almost indistinguishable from the original at a much smaller size. Use 90–95 for print and important shots. Below 70 the artifacts become visible. For screenshots, text and graphics, avoid JPEG entirely — use PNG instead.
JPEG is tuned for the smooth gradients of real photographs, where losing tiny detail goes unnoticed. Text, lines and interfaces are made of sharp, high-contrast edges — exactly the "high frequencies" JPEG discards first. That is why letters grow halos and mosquito noise. Such graphics need a lossless format like PNG.
Every time you re-save a JPEG, it goes through another full round of lossy compression. The software re-splits the image into blocks and discards detail again, and the block grid no longer lines up with the previous pass. The artifacts accumulate: after a dozen re-saves a photo visibly falls apart. So edit from the original or in a lossless format, and save to JPEG only once, at the very end.