🔬 Lossy or lossless

Is JPEG XL Lossless?

Both. JPEG XL does lossless and lossy in a single format, and it has a third trick neither JPEG nor PNG can manage: shrinking an existing JPEG by around 20% while being able to rebuild the original byte for byte.

by Robert Castillo · Published · updated

✅ Lossless mode📉 Lossy mode🔄 Reversible JPEG re-packing

The short answer

Most image formats pick a side. PNG is always lossless: every pixel survives, and files are large. JPEG is always lossy: it throws away detail your eye probably won't miss, and files are small. You choose the format, and the format chooses the trade-off for you.

JPEG XL doesn't work that way. The same format handles both, so you pick the behaviour per image instead of picking a different format each time. That's why you'll see it described as lossless in one article and lossy in another — both are right.

The three ways to save a JPEG XL

🔒

Fully lossless

Every pixel preserved exactly, like PNG, and usually smaller: about a third smaller on photos in our own test.

📉

Lossy

Detail discarded to save space, like JPEG, but noticeably better looking at the same file size.

🔄

Lossless JPEG re-packing

Takes a JPEG you already have and stores it ~20% smaller, with the original recoverable byte for byte.

That third mode is the one people miss, and it's the most immediately useful of the three. It isn't converting your photo to a new format in the usual sense — it's storing the same JPEG data more efficiently, and it can be undone perfectly.

How the quality setting actually works

JPEG XL doesn't use a 0-100 «quality» slider like JPEG does. It uses a setting called distance, which describes how far the result is allowed to drift from the original. Lower means closer.

A distance of 0 is mathematically lossless: the decoded image is identical to what went in. Around 1.0 is the usual default and is generally described as visually lossless — you're extremely unlikely to tell the difference on screen, even though bits have been discarded. Higher numbers trade visible quality for smaller files.

DistanceWhat you getUse it for
0Mathematically identical to the originalArchiving, master copies, graphics
~1.0Visually indistinguishable in normal viewingThe sensible default for photos
2-3Small differences if you go lookingWeb images where size matters
5+Visible degradationThumbnails and previews only

The re-packing trick, in plain terms

A normal JPEG stores its image data in a way that was efficient in 1992. JPEG XL can take that exact same data and store it using a modern entropy coder — a better method of writing down the same information — without altering a single one of the values that describe the picture.

The result is a file roughly 20% smaller that contains, mathematically, the identical image. And because nothing was discarded, the process reverses: you can turn the .jxl back into the original .jpg and get a file identical to the one you started with, byte for byte. Not «looks the same» — the same.

For anyone sitting on a decade of phone photos, that's a fifth of the storage back with nothing given up and no decision to regret later.

Lossless compared to PNG

If lossless is what you want, PNG is the format most people reach for, and JPEG XL beats it comfortably: in our own test lossless JPEG XL came out about a third smaller than a maximally optimised PNG on photos and about 40% smaller on illustrations (screenshots are the exception: at the default setting PNG sometimes wins, and you need a higher effort to beat it — the details are in JPEG XL vs PNG), with support for higher bit depths and, unlike PNG, sensible handling of photographic content.

PNG's advantage is that it opens absolutely everywhere, which is the same argument that keeps coming up with every modern format. If the file needs to be opened by other people or other software today, PNG is still the safer choice — see the software support guide for where JPEG XL currently stands.

How to tell which one you have got

There is no marking on the outside of a .jxl file that says «lossless», and nothing in the filename will tell you either. What you can do is reason from where the file came from, which in practice answers it.

If you re-packed an existing JPEG — the mode this site uses for JPG to JXL — it is lossless by definition, and you can prove it: convert the .jxl back to .jpg and compare the result against your original. The two files will be identical, right down to the size in bytes. If they match, nothing was lost.

If the file was exported from a camera or an editing application, it depends on the setting used at export, and only whoever saved it knows. As a rough rule, a .jxl that is dramatically smaller than the equivalent PNG of the same image is lossy; one that is merely somewhat smaller is probably lossless.

Common questions

How do I know if a .jxl file is lossless?
Nothing in the file announces it. If you created it by re-packing a JPEG it is lossless, and you can prove it by converting back and comparing file sizes.
Is JPEG XL lossless or lossy?
It supports both, chosen per image. That flexibility is one of the format's main design goals, and it's why you'll find it described either way.
Does converting JPG to JPEG XL lose quality?
Not in lossless re-packing mode, which is what this site uses. The image data is stored more efficiently but is mathematically identical, and the original JPEG can be rebuilt exactly.
Can I get my original JPEG back?
Yes, if it was re-packed losslessly. The reconstruction is byte-for-byte identical to the file you started with.
Is lossless JPEG XL smaller than PNG?
Usually, yes — about a third smaller on photos in our test, with no quality difference, because both are lossless. Screenshots are the exception: at the default setting PNG sometimes wins.
What does «distance» mean in JPEG XL?
It's the quality setting, but inverted: 0 is mathematically lossless and higher numbers allow more deviation. Around 1.0 is the usual visually-lossless default.
Is «visually lossless» the same as lossless?
No. Visually lossless means you won't notice the difference; data has still been discarded. True lossless means the decoded image is identical, bit for bit.