Back to Blog
Guides7 min read

JPEG Compression Explained: How It Works & Why It Matters

JPEG is the world's most used image format. Understanding how its compression works helps you make smarter decisions about image quality and file size.

What is JPEG compression?

JPEG (Joint Photographic Experts Group) compression reduces file size by selectively discarding visual information that the human eye is less sensitive to. It's a lossy compression method — some data is permanently removed each time you save.

The magic lies in a mathematical technique called the Discrete Cosine Transform (DCT), which converts pixel data into frequency data. High-frequency detail (fine textures) can be discarded with minimal visual impact.

The compression pipeline

  1. Colour space conversion: RGB is converted to YCbCr (luminance + chrominance). The human eye is more sensitive to brightness than colour, so chrominance can be downsampled.
  2. Block division: The image is divided into 8×8 pixel blocks.
  3. DCT transform: Each block is converted from spatial domain to frequency domain.
  4. Quantisation: This is where compression happens. High-frequency coefficients are rounded or zeroed out based on the quality level.
  5. Encoding: The remaining data is compressed using Huffman coding.

Quality levels: What the numbers mean

QualityFile size reductionVisual impactBest for
95–100%Minimal (2–3×)Virtually identical to originalProfessional photography
80–90%Moderate (5–10×)Barely noticeableWeb images, documents
60–75%Significant (10–20×)Visible on close inspectionThumbnails, previews
Below 50%Extreme (20–50×)Obvious artefactsVery small file size needs

For passport and exam photos, 80–90% quality is the sweet spot — small enough for upload limits while maintaining clarity. Use PhotoResizer.in to compress to exact KB targets.

Re-compression: Why saving JPEG multiple times is bad

Each time you open, edit, and re-save a JPEG, it goes through the compression pipeline again. This is called generation loss. After 5–10 re-saves, visible artefacts accumulate, especially around high-contrast edges.

Best practice: Always edit from the original file, and only save the final output as JPEG. If you need to make multiple edits, work in PNG or TIFF until the final export.

Frequently Asked Questions

Is JPEG the same as JPG?

Yes. They are identical formats. The .jpg extension originated from Windows' 3-character file extension limit. Modern systems support both .jpeg and .jpg interchangeably.

What quality should I use for JPEG compression?

For most purposes, 80–90% quality provides an excellent balance. Below 70%, visible artefacts start appearing. Above 95%, file sizes become unnecessarily large with minimal quality improvement.

Can I uncompress a JPEG back to original quality?

No. JPEG is lossy — the discarded data cannot be recovered. Always keep the original uncompressed file as a backup before compressing.

Ready to resize your photo?

Use our Image Resizer to hit exact KB and pixel targets, or try the Background Color Changer for a perfect white backdrop.