What Is JPG (JPEG) Format? How It Works, When to Use It, and Its Limits
Table of Contents
- TL;DR Quick Reference
- JPG vs JPEG — The Name Explained
- How JPEG Compression Actually Works (DCT)
- Quality Settings 1–100: What They Really Mean
- Chroma Subsampling: The Hidden Quality Factor
- EXIF Metadata in JPEG
- When to Use JPEG
- When NOT to Use JPEG
- JPEG vs PNG vs WebP vs AVIF
- JPEG Successors — What Comes Next
- Frequently Asked Questions
Open any photo on your phone, download an image from the web, or attach a picture to an email — there is better than an 80% chance you are working with a JPEG file. It is the single most widely used image format in the world, built into virtually every camera, smartphone, operating system, and web browser made in the last three decades. And yet most people have no idea how it actually works, or when they should stop using it.
This guide explains what JPG (JPEG) is, how its compression algorithm works in plain English — including the parts that are rarely explained, like chroma subsampling — and gives you the exact rules for when to use it and when to reach for a different format.
1. TL;DR Quick Reference
The direct answer: JPEG (also called JPG) is a lossy image compression format created in 1992 by the Joint Photographic Experts Group. It uses Discrete Cosine Transform (DCT) to compress images by discarding visual information the human eye is least likely to notice — primarily high-frequency detail in areas of fine texture and smooth gradients. The result: photographic images at 5–15% of their original uncompressed size with no visible quality difference at quality settings of 80 or above.
Best for: photographs, web images, email attachments, digital camera output. Avoid for: images with text, logos, sharp edges, or any content requiring transparency. For websites, WebP is now the better default — 25–34% smaller at equivalent visual quality.
2. JPG vs JPEG — The Name Explained
JPEG and JPG are exactly the same format. The name JPEG stands for Joint Photographic Experts Group — the ISO/ITU technical committee that designed the standard, formally published in 1992 as ISO/IEC 10918. The format was designed with a single goal: make photographic images dramatically smaller so they could be stored on hard drives, transmitted over the slow modem connections of the early internet, and displayed on the low-powered computers of that era.
The file extension was shortened to .jpg for a purely historical reason: early versions of Microsoft Windows running on MS-DOS enforced a three-character limit on file extensions. The extension .jpeg has four characters, so it was truncated to .jpg. Mac OS and Unix systems never had this restriction and accepted .jpeg from the start.
Today, both extensions are used interchangeably and every application that handles images accepts both. There is no difference whatsoever in compression, quality, colour depth, or any other technical property between a file named photo.jpg and one named photo.jpeg. They are the same format, the same encoding, producing the same output.
3. How JPEG Compression Actually Works (DCT Explained)
JPEG compression is built on a mathematical technique called the Discrete Cosine Transform (DCT). The algorithm does not simply throw away random pixels — it is far more intelligent than that. It exploits a fundamental property of human vision: we are far more sensitive to variations in brightness than to variations in colour, and we are much better at detecting large-scale patterns than fine high-frequency detail.
Here is what happens inside the encoder, step by step:
The image is converted from RGB (red, green, blue channels) to YCbCr — a format that separates luminance (brightness, Y) from chrominance (colour, Cb and Cr). The colour channels are then typically downsampled to half their resolution. Human eyes tolerate colour blur far better than brightness blur. This downsampling alone accounts for a significant share of JPEG's size reduction — before any lossy compression has occurred.
The image is divided into a grid of small 8x8 pixel blocks. Each block is processed independently. This is why, at very low JPEG quality settings, you can see a grid pattern of 8x8 squares — the block boundaries where quantisation has been applied too aggressively.
Each 8x8 block is passed through the DCT, which converts the 64 pixel values into 64 frequency coefficients. Think of it as describing the block in terms of waves rather than individual dots. One coefficient (the "DC" coefficient) represents the average colour of the whole block. The remaining 63 (the "AC" coefficients) represent progressively finer patterns — from gentle gradients to fine-grained texture.
Each frequency coefficient is divided by a value from a quantisation table. The table uses small divisors for low-frequency (coarse) detail — preserving it precisely — and large divisors for high-frequency (fine) detail, which rounds those values aggressively, often to zero. This is where data is permanently discarded. The quality setting (1–100) directly controls how aggressive the quantisation table is: quality 100 uses minimal quantisation; quality 1 uses extreme quantisation.
The quantised coefficients — now mostly zeros for high-frequency components — are compressed losslessly using Huffman coding, which efficiently encodes runs of identical values. This final stage is completely reversible and adds no quality loss.
When you open a JPEG, the process runs in reverse — except that the discarded high-frequency detail cannot be recovered. The decoder reconstructs the image from the surviving coefficients, and the visual result is an approximation of the original that your eye typically cannot distinguish from the real thing at quality settings of 80 or above.
4. Quality Settings 1–100: What They Really Mean
The quality slider visible when saving a JPEG in most applications (Photoshop, GIMP, Lightroom, export tools) directly controls the aggressiveness of the quantisation tables. Understanding what different quality values actually produce helps you avoid the two failure modes: files that are unnecessarily large (quality too high) or visibly degraded (quality too low).
| Quality | Visual appearance | Typical file size* | Best use case |
|---|---|---|---|
| 95–100 | Near-lossless — indistinguishable from original | 60–90% of uncompressed | Master files, re-editing source, high-end print |
| 85–94 | Excellent — no visible artefacts | 30–60% of uncompressed | Professional web, stock photography delivery |
| 75–84 | Good — artefacts only visible on close inspection in gradients | 15–30% of uncompressed | Standard web images, social media, email |
| 60–74 | Acceptable — faint blocking in smooth areas | 8–15% of uncompressed | Thumbnails, image previews, low-bandwidth delivery |
| 40–59 | Noticeable artefacts — blocky gradients, colour banding | 4–8% of uncompressed | Very low bandwidth only — significant quality tradeoff |
| Below 40 | Heavy degradation — 8x8 blocks clearly visible | Under 4% of uncompressed | Impractical for most uses |
* For a typical 12-megapixel photograph. Actual sizes vary by image complexity and content.
Critical rule: never use JPEG as a working or archival format. Every time you open a JPEG, edit it, and save it again, the image is re-encoded from scratch. Each re-encode applies a new round of quantisation to an already-quantised image — stacking additional loss on top of existing loss. After several re-saves, visible artefacts accumulate even at high quality settings. Keep working copies as PNG, TIFF, PSD, or camera RAW. Export to JPEG only at the final delivery stage, and only once.
5. Chroma Subsampling: The Hidden Quality Factor
Chroma subsampling is one of the most significant factors in JPEG quality that most people have never heard of — and most software exposes it only as an advanced option, if at all. It is a technique that takes advantage of the fact that human vision is much less sensitive to colour resolution than to brightness resolution.
In the JPEG pipeline, after the image is converted to YCbCr colour space, the colour channels (Cb and Cr — which carry colour information) can be stored at lower resolution than the luminance channel (Y — which carries brightness). Three subsampling schemes are in common use:
| Subsampling | What it means | Quality impact | File size impact |
|---|---|---|---|
| 4:4:4 | Full colour resolution — every pixel has its own colour values | Maximum quality — no colour loss | Largest of the three |
| 4:2:2 | Colour sampled at half horizontal resolution | Slight colour loss — usually imperceptible in photographs | ~25% smaller than 4:4:4 |
| 4:2:0 | Colour sampled at half horizontal and half vertical resolution | Noticeable on sharp colour edges and fine detail | ~33% smaller than 4:4:4 |
Most JPEG encoders — including those in most digital cameras — use 4:2:0 by default because it produces the smallest files with the least perceptible quality loss for typical photographic subjects. The problem arises in specific situations:
- Images with saturated, high-contrast colour edges — the sharp boundary between a red object and a blue background, for example, may show colour fringing with 4:2:0 subsampling.
- Images with fine text on coloured backgrounds — the colour channel blurring from 4:2:0 smears colour information at letter edges, making coloured text appear less sharp.
- Product photography with fine colour detail — fabric textures with fine colour patterns may lose detail with 4:2:0.
If you are exporting JPEGs where colour accuracy matters — product photography, images with vibrant colour patterns, or anything you plan to re-edit — use 4:4:4 subsampling in your export settings (Photoshop: Export As → Quality → check "4:4:4" under "Subsampling"). The file size increase is modest but the quality retention is meaningful.
6. EXIF Metadata in JPEG
JPEG is unique among common image formats in that it was designed from the start to carry rich embedded metadata — information about the image and the conditions under which it was taken. This metadata is stored in EXIF (Exchangeable Image File Format) blocks within the JPEG file and is invisible in the image itself but accessible to any application that reads EXIF data.
EXIF metadata in a typical camera JPEG includes:
- Camera make and model — which camera and lens was used
- Date and time — exact timestamp of the shot
- Exposure settings — aperture (f-stop), shutter speed, ISO sensitivity
- Flash status — whether flash fired and mode
- GPS coordinates — latitude, longitude, and altitude if the camera or phone had GPS
- Orientation — whether the image should be rotated for display (this is why JPEGs from phones can sometimes display sideways in software that ignores EXIF orientation)
- Colour profile — embedded ICC colour profile (usually sRGB, sometimes a device-specific profile)
- Thumbnail — an embedded low-resolution preview used by photo management software
Privacy Implications of EXIF Data
GPS coordinates in EXIF data are a privacy concern that most people are unaware of. A JPEG taken with a smartphone's default camera settings contains the exact GPS coordinates of where the photo was taken — embedded invisibly in the file. Sharing this file publicly, uploading it to a website, or sending it as an attachment can expose your location data to anyone who knows how to read EXIF metadata (which requires nothing more than any standard photo viewer or a free online EXIF reader).
To strip EXIF data before sharing: use the "Strip metadata" option in your export tool, or convert to a format that does not carry EXIF (PNG does not embed GPS by default). On Windows, right-click the image → Properties → Details → "Remove Properties and Personal Information." On macOS, you can strip EXIF using Preview or ImageOptim.
EXIF Data and File Size
EXIF metadata adds 20–100 KB of file size to a JPEG with no visual benefit. For web images, stripping EXIF data before serving is best practice — it reduces file size, eliminates the privacy exposure, and the metadata is irrelevant to web visitors. Most image optimisation tools (Squoosh, ImageOptim, ShortPixel) strip EXIF automatically.
7. When to Use JPEG
JPEG's compression algorithm is specifically tuned for continuous-tone photographic content — images where colour values transition gradually across large areas, with complex texture and subtle tonal gradations. It excels for:
Photographs
The format it was designed for. Portraits, landscapes, product photos, travel shots — JPEG is ideal when the image has smooth tonal gradations and rich colour variation. This is the use case where it genuinely excels.
Digital Camera Output
The JPEG pipeline is built into camera hardware at the firmware level. Unless you shoot RAW, your camera outputs JPEG. The ISP (Image Signal Processor) applies tone mapping, sharpening, and JPEG encoding in-camera.
Email Attachments
Universal compatibility means any email client on any device opens a JPEG without plugins or conversion. Smaller than PNG for the same photograph. The safe, universal choice for sharing photos via email.
Social Media
Most platforms re-compress on upload anyway. Uploading as high-quality JPEG (Q85+) minimises cumulative degradation from double compression. Platforms apply their own optimisation regardless of your input format.
Web Photography (without WebP)
For teams that have not set up WebP delivery, JPEG is the reliable fallback with 100% browser support. At quality 80–85, web images are compact and look excellent on any display.
Print Production
Professional labs accept JPEG. JPEG supports CMYK colour space required for commercial printing. At quality 90–95, a JPEG is visually indistinguishable from a TIFF at typical 300 DPI print resolutions.
8. When NOT to Use JPEG
JPEG's DCT block structure is fundamentally ill-suited to certain types of image content. It was designed for smooth photographic gradients — it performs poorly whenever those assumptions break down:
Logos and Icons
Hard edges of vector-style graphics produce visible blocky artefacts around every contrast boundary at any quality setting. Use SVG (infinite scalability) or PNG instead.
Screenshots
Screenshots have flat colour areas and sharp text. JPEG smears and colour-fringes around every character, making text unreadable at lower quality settings. Always screenshot as PNG.
Images With Text Overlay
Infographics, presentation slides, price cards, watermarks — any image where text must remain sharp and legible requires lossless compression. JPEG blurs text edges.
Images Requiring Transparency
JPEG has no alpha channel. Any transparent regions are filled with solid colour — typically white. For transparent backgrounds, use PNG or WebP.
Animations
JPEG is a single static frame format. For animated images, use WebP (best quality and size), GIF (legacy compatibility), or AVIF (next-generation).
Working / Source Files
Every re-save compounds quality loss. Keep working files as PNG, TIFF, PSD, or camera RAW. Export to JPEG only for final delivery, only once, from the best-quality source available.
Convert JPEG to the Right Format for Your Use Case
Need transparency? Convert to PNG. Serving on a website? Convert to WebP for 25–34% smaller files. Need to share as a document? Convert to PDF. All free, all in-browser.
9. JPEG vs PNG vs WebP vs AVIF: Format Comparison
Choosing the right format for your specific use case requires understanding how each compares across the dimensions that matter:
| Feature | JPEG | PNG | WebP | AVIF |
|---|---|---|---|---|
| Compression type | Lossy only | Lossless only | Lossy + lossless | Lossy + lossless |
| File size (photos) | Baseline | 3–5× larger | 25–34% smaller | 40–50% smaller |
| Transparency | None | Full 8-bit alpha | Full 8-bit alpha | Full alpha |
| Animation | None | APNG (limited) | Yes (full colour) | Yes (full colour) |
| CMYK support | Yes | RGB only | No | Limited |
| Browser support | 100% | 100% | 97%+ | 90%+ (growing) |
| Email support | Universal | Universal | Poor (no Outlook) | Limited |
| Software support | Universal | Universal | Modern apps | Growing |
| Best for | Photos, email, cameras, print | Screenshots, logos, transparency | Web delivery, page speed | Web delivery (cutting-edge) |
10. JPEG Successors — Why JPEG Is Still Dominant
Several formats have been designed to supersede JPEG, and some are genuinely superior in technical terms. Understanding why JPEG still dominates in 2026 requires understanding what each successor actually offers and where it falls short in adoption:
WebP (2010)
WebP achieves 25–34% smaller files than JPEG at equivalent visual quality using a more modern compression algorithm based on VP8 video coding. It supports transparency and animation that JPEG lacks. Browser support reached near-universality in 2020 when Safari added support. For web images, WebP is now the practical default — the tooling is mature, the fallback patterns (<picture> element) are well-established, and the file size savings are real. WebP has not displaced JPEG for email, print, or non-browser contexts because of the software support gaps described above.
AVIF (2019)
AVIF (AV1 Image Format) is based on the AV1 video codec and achieves 40–50% smaller files than JPEG — a significantly larger advantage than WebP. It supports wide colour gamut, HDR content, 12-bit colour depth, and film grain synthesis for photographic noise. Browser support is good: Chrome 85+, Firefox 93+, Safari 16+. The limitation is encoding speed: AVIF encoding is very slow (10–100× slower than JPEG encoding), making it impractical for on-the-fly generation. Pre-encode at build time and serve statically. As encoding tools mature and hardware acceleration arrives, AVIF will become the dominant web format — but WebP is the practical choice today.
JPEG 2000
JPEG 2000 (2000) uses wavelet compression rather than DCT, offering better quality at similar file sizes and eliminating the 8x8 block artefact pattern. It was adopted in professional cinema (as DCI JPEG 2000) and medical imaging, but never achieved mainstream adoption because of high licensing complexity and the lack of browser support. Safari was the only browser to support JPEG 2000, and it is now deprecated in favour of HEIC/HEIF and WebP. JPEG 2000 is a technical success that failed in the market.
JPEG XL (2022)
JPEG XL is the most technically impressive JPEG successor — it offers better compression than both WebP and AVIF, supports lossless transcoding from existing JPEG files (meaning you can convert your entire JPEG library to JPEG XL with a reversible encoding, then delete the originals without any quality loss), and supports progressive decoding, animation, and HDR. The catch: Chrome removed its experimental JPEG XL support in 2023, citing insufficient use. As of 2026, only Safari has widespread JPEG XL support. It remains to be seen whether JPEG XL achieves the adoption necessary to become a web standard.
Why JPEG Itself Remains Dominant
JPEG remains the most-used image format on the internet in 2026 for several interconnected reasons:
- 30+ years of deployed infrastructure — every camera, every phone, every image processing library supports JPEG without any additional libraries or configuration.
- Hardware acceleration everywhere — JPEG encode and decode is implemented in silicon on virtually every CPU, GPU, and camera ISP ever made. Processing is essentially free.
- Email and print contexts — WebP and AVIF have not penetrated email clients or print workflows. JPEG remains the only safe choice there.
- Camera output — digital cameras and smartphones output JPEG by default. The vast majority of new images created globally are created as JPEG.
- Good enough for most web uses — at quality 82–85, JPEG is visually excellent and the file sizes, while larger than WebP, are still manageable. The incremental improvement from WebP or AVIF is real but not always worth the tooling complexity for smaller sites.
11. Frequently Asked Questions
What is the difference between JPG and JPEG?
Does saving JPEG repeatedly reduce quality?
What quality setting should I use for web JPEG?
Does JPEG support transparency?
Why does JPEG blur text?
Is JPEG lossless or lossy?
What is the maximum file size for JPEG?
What replaced JPEG?
JPEG has survived 30+ years and hundreds of competitors because it solved a real problem extremely well: compressing photographic images to a fraction of their original size with no visible quality loss. It remains the right choice for cameras, email, and print in 2026. For web delivery, converting to WebP captures a meaningful 25–34% file size improvement — use the converters above to do it instantly in your browser.