File Formats & Media

JPEG File

Definition

JPEG is named after the Joint Photographic Experts Group and was standardised as ISO/IEC 10918-1 in 1992; the extension is .jpg or .jpeg and the MIME type is image/jpeg. It uses lossy compression controlled by a quality setting, usually shown as a number from 0 to 100 — a figure that is specific to the encoder, not a unit defined by the standard, so quality 80 in one tool is not exactly quality 80 in another. There is no transparency: a JPEG has no alpha channel, and anything transparent gets flattened onto a background colour on export. Files start with the bytes FF D8 FF. Baseline JPEGs paint top to bottom as they arrive, while progressive JPEGs store several passes so a rough version of the whole image appears early.

Why It Matters

Two settings decide almost everything about a JPEG, and both are easy to get wrong. The first is quality: moving from 85 to 95 can double the file for a difference most people cannot see, while dropping below about 60 starts to show blocking in skies and skin. The second is how often the file is re-encoded. Every save runs the image through quantisation again, so detail already approximated gets approximated once more — open, crop, save, repeat ten times at quality 80 and the edges visibly crumble. This is generation loss, and it is why you keep an untouched master and export fresh copies from it rather than editing the published file in place. Where transparency is needed, a PNG or WebP is the answer instead.

How It Works

The encoder converts RGB to YCbCr, separating brightness from colour, then usually applies 4:2:0 chroma subsampling, which stores colour at half resolution in each direction because the eye is far less sensitive to it. Each channel is cut into 8 by 8 blocks and run through a discrete cosine transform, and the resulting coefficients are divided by a quantisation table scaled by the quality setting and rounded — that rounding is where the information goes. What survives is Huffman coded losslessly. Encoders differ: mozjpeg produces files roughly 10 percent smaller than libjpeg at matching visual quality, and enabling progressive mode usually saves a few percent as well. JPEGs also carry EXIF metadata, including orientation and sometimes GPS coordinates, which is worth stripping before anything is published.

Real-World Example

A traveller uploads camera originals to a photo essay hosted on 99helpers at travel-notes.99helpers.site. Each 12-megapixel file is around 6.2 MB, so twenty of them make a 124 MB page that nobody on a phone will wait for. Re-exported at 1800 pixels wide, quality 78, progressive, with EXIF stripped, they average 240 KB — the whole gallery now under 5 MB. The masters stay on the laptop, which matters the next time a crop is needed; this is straightforward image hosting, with the resizing done before the upload rather than by the server.

Common Mistakes

  • Editing and re-saving the published JPEG instead of exporting again from the original — each round trip bakes in more artefacts that cannot be undone
  • Pushing quality to 95 or 100 out of caution — the file doubles or triples while the visible gain stops somewhere around 85
  • Using JPEG for screenshots, logos or text — the 8 by 8 blocks leave visible ringing along every sharp edge
  • Publishing straight from a phone or camera with EXIF intact — the GPS coordinates of where the photo was taken travel with the file

Related Terms

Put a file online in seconds

Drop in a document, an image, a page or a whole static website and share the link — free, with no build step and no server to set up.

Host a file free →