Everything you need to know about JPG
JPG (Joint Photographic Experts Group, .jpg or .jpeg) is the workhorse of digital photography. Standardized as ISO/IEC 10918-1 in 1992, it uses lossy compression specifically tuned for photographic images. Three decades later, every camera, every phone, every web platform still uses JPG as the default photo format.
How it works under the hood
- DCT-based compression. JPG splits the image into 8x8 pixel blocks, applies Discrete Cosine Transform, quantizes coefficients (this is where information is lost), then Huffman codes the result.
- YCbCr color space. Internally, JPG separates luminance (Y) from chroma (Cb, Cr) and downsamples chroma 2:1 or 4:1 - exploiting that human eyes care less about color detail than brightness.
- Quality 80 sweet spot. JPG quality 80-85 is visually transparent for photos. Quality 95+ wastes bytes. Quality below 70 introduces visible blocking artifacts.
- EXIF metadata. Camera info (aperture, shutter, GPS, date) is stored in EXIF tags - a separate metadata format JPG didn't originally have.
Where you'll actually use it
- Photography: cameras, phones, photo editing pipelines
- Web images where file size matters more than perfection
- E-commerce product photos
- Email attachments (universal compatibility)
How it compares to alternatives
JPG vs PNG: JPG for photos (smaller); PNG for graphics/screenshots (lossless, transparency). JPG vs WebP: WebP is 25-35% smaller at the same quality - use WebP if all your users have modern browsers. JPG vs HEIC: HEIC compresses ~50% better but isn't universally supported outside Apple.
Things that will trip you up
- Re-saving a JPG re-quantizes it - quality degrades each time. Edit in lossless format and export to JPG only at the end.
- Strip EXIF metadata before sharing - GPS coordinates can leak your location
- Progressive JPG renders in passes (low-res first, then refines) - better UX on slow connections, but ~10% larger