How JPG compression works
JPG compression is built on a mathematical transform called the Discrete Cosine Transform, which breaks the image into small frequency blocks, discards high-frequency detail that the eye is less sensitive to, and then encodes the remaining information with Huffman coding. The quality slider you see in most export dialogs controls the quantization table, which is essentially a mask telling the encoder how aggressively to discard each frequency band. At quality 90, the loss is nearly invisible. At quality 50, blocky artifacts and chroma smearing become obvious. At quality 20, the image becomes a mosaic of compression squares. This design makes JPG spectacularly efficient for photographs but fundamentally unsuited for images with sharp edges, text, or flat color regions because those high-frequency boundaries are exactly what the encoder discards.
JPG quality levels in practice
In real-world workflows, quality 80–90 is the sweet spot for web photos and social media uploads, where the file size reduction is substantial and the visual loss is acceptable on typical screens. Quality 60–70 is often used for thumbnail previews or inline images where the viewer is not zooming in. Quality 95–100 is used for print preparation and high-resolution archival copies, though even maximum quality JPG is still lossy. One critical limitation is generational loss: every time you open a JPG, edit it, and re-save as JPG, another round of compression is applied. After five or ten generations, the cumulative artifacts become visible. For this reason, always keep an original uncompressed or lossless master file and treat JPG as a final delivery format rather than an editing format.
When JPG is the right choice
JPG is the default format for photographs, camera exports, and any image where the content is continuous tone rather than sharp edges. It is the standard for social media uploads, email attachments, e-commerce product photos, blog featured images, and print-to-web workflows. If you are sharing a photo from your phone, uploading a portrait to a website, or attaching a product image to a marketplace listing, JPG is almost always the correct format because the receiving system expects it, the file size is manageable, and the visual quality is acceptable for the intended viewing distance. The only exceptions are when you need transparency, when the image contains text or logos that must remain crisp, or when the image will be edited repeatedly.
When to avoid JPG
Do not use JPG for screenshots, interface mockups, diagrams, logos, or any image containing text, because the compression will blur the edges and create mosquito artifacts around high-contrast boundaries. Do not use JPG when you need transparency, because the format does not support an alpha channel and will flatten transparent areas to a solid color, usually white or black. Do not use JPG as an intermediate editing format, because each re-save compounds quality loss. Do not use JPG for line art, flat color illustrations, or cartoon-style graphics, because PNG or SVG will produce smaller files and sharper results for those content types. If your image is a logo on a transparent background, a user interface screenshot, or a technical diagram with small text, JPG is the wrong tool for the job.