Lean Image
Open menu

The JPEG (JPG) format

JPEG is thirty-four years old and still holds most of the photographs on the internet. It is lossy, it has no transparency, it degrades a little every time you save it, and none of that has been enough to dislodge it — because everything with a screen made since the mid-nineties opens one without being asked. Here is what it does, what it costs you, and when to move off it.

JPEG at a glance

Introduced
1992 · Joint Photographic Experts Group
File extensions
.jpg, .jpeg
MIME type
image/jpeg
Compression
Lossy
Transparency
No
Animation
No
Colour depth
8 bits per channel
Wide gamut
sRGB only
High dynamic range
No
Maximum dimension
65,535 px per side
Support
Everywhere, without exception

Lean Image reads JPEG and writes it.

Where it came from

JPEG is a committee’s name that became a file format. The Joint Photographic Experts Group published the standard in 1992, and the mechanism at its centre is the discrete cosine transform. The image is cut into 8×8 blocks; each block is described as a sum of frequency patterns rather than as sixty-four separate pixels; and the high-frequency coefficients — the fine detail — are divided down by a quantisation table until most of them round to zero. Zeros compress to almost nothing. The quality slider you are used to is a scaling factor on that table, and nothing more.

A second trick sits alongside it. Human vision resolves brightness far better than colour, so JPEG keeps luminance intact and stores the colour channels at half resolution. A good deal of what a JPEG throws away is colour detail nobody was going to see.

Why nothing has replaced it

Plenty have tried. JPEG 2000 arrived in 2000 with wavelets in place of blocks and was genuinely better at matched quality; it was also complex, expensive to implement and legally unclear at the wrong moment, and it ended up in cinema, medical imaging and archives rather than on the web. JPEG XR followed from Microsoft and went nowhere at all. WebP, AVIF and JPEG XL all beat JPEG comfortably on size today.

None of them displaced it, because replacing a universal format takes more than being better than it. A JPEG opens on a twenty-year-old phone, a print shop’s workflow, a hospital’s imaging suite and whatever ships in 2040, with no plugin, no extension and no conversation about it. New formats win new pages. They do not win the archive.

What it costs you

Generation loss is real. Every save re-quantises the picture against a fresh block grid, so opening a JPEG, cropping it and saving again puts it through the mangle a second time — and if the crop was not a multiple of eight pixels, the grid has moved, and the last round’s artefacts are re-encoded as if they were detail. Keep an original in something lossless and export JPEG at the end of a process rather than in the middle of one. Converting here is a single re-encode of the file you dropped in, but nothing can undo what earlier saves already removed.

There is no transparency, and there will not be. A baseline JPEG has three channels and no fourth. The format is frozen precisely because every decoder on earth implements the frozen version, so this is not a gap waiting to be filled. Convert a transparent PNG to JPG and those pixels are composited onto a flat background, because there is nowhere else for them to go.

Eight bits per channel, sRGB. Enough for almost everything, and visible as banding in a clear sky or a studio backdrop — which is exactly where the 10- and 12-bit formats earn their keep.

What to convert it to

For the web, WebP. Meaningfully smaller at a quality you will not pick out in a blind comparison, and displayed by every browser in current use.

AVIF when size matters more than conversion time: smaller again, slower to encode, and less likely to open in software outside a browser.

PNG only when something specifically asks for it — an editor, or an image that is about to have transparency added. It restores nothing, and the file will usually be several times larger.

Whichever you pick, the work happens in your browser: the file is never uploaded, and the EXIF block, including the GPS coordinates a phone writes into every photo, is dropped on the way out.

Convert a JPG into something else

Convert something else into JPG

Make one smaller

Questions about JPEG

Is JPG the same thing as JPEG?

One format, two spellings. Three-letter extensions were an MS-DOS limitation and the habit stuck, so .jpg and .jpeg are the same bytes. This site uses jpg as the canonical name, and /formats/jpeg redirects here.

Does re-saving a JPEG make it worse every time?

Yes, slightly, every time. Each save re-quantises the image against a fresh 8×8 block grid, and if a crop has shifted that grid the previous round’s artefacts get encoded as though they were detail. One conversion is fine; a chain of them is not.

Can a JPEG have a transparent background?

No, and it never will. There are three channels and no alpha channel, and the format has been frozen for decades. Transparent pixels are flattened onto a solid background — usually white — when you convert. Use PNG or WebP when the transparency matters.

Does converting a JPEG to PNG improve the quality?

No. It preserves exactly what is in the file today, compression artefacts included, and usually produces a file several times larger, because lossless compression has to store the artefacts as faithfully as the picture. Convert to PNG when something needs PNG.

Why did JPEG 2000 never take over?

It was better, and it was late, complicated and legally murky at exactly the moment browsers were deciding what to support. It found a home in cinema masters, medical imaging and archives instead. Safari is the only browser that ever displayed one.

Work with a JPG file

Drop one in and see what comes out, without uploading anything.