All formats

JPEG XL (JXL)

Full nameJPEG XL
Extensions.jxl
MIME typeimage/jxl
Typeraster image, lossy and lossless compression, animation
Starts withFF 0A (bare codestream) or 00 00 00 0C 4A 58 4C 20 0D 0A 87 0A (container)
SpecificationISO/IEC 18181-1:2024 (codestream), ISO/IEC 18181-2 (file format)
Maintained byISO/IEC JTC 1/SC 29 (JPEG committee)
Reference implementationlibjxl (BSD-3-Clause)
Licenseopen, royalty-free

JPEG XL is a still-image format that covers what JPEG, PNG and GIF do in one file type: lossy compression for photos, lossless compression for graphics, alpha transparency, animation, up to 32-bit float samples, HDR, wide color gamut and progressive decoding. At the same visual quality a lossy JPEG XL file is usually 30-60% smaller than a JPEG.

Its special feature is lossless JPEG recompression: an existing JPEG file can be converted to JPEG XL about 20% smaller, and the original JPEG can be rebuilt from it bit for bit. That makes it a good format for archiving photo collections without any quality loss.

When to use JPEG XL#

File structure#

A JPEG XL file is either a bare codestream or a container that wraps the codestream in ISOBMFF boxes (the same box format as MP4, HEIF and AVIF).

Bare codestream#

The file starts with FF 0A, followed by a bit-packed header. There are no byte-aligned fields to read in a hex editor after the signature: use a decoder or jxlinfo to see the header.

FF 0A        codestream signature
xx xx ...    SizeHeader (width, height), ImageMetadata, then frames

A bare codestream is the smallest form. It can hold the image, color space (as an enum or ICC profile), orientation, animation and extra channels, but no Exif or XMP.

Container#

The container is used when the file has Exif, XMP or JUMBF metadata, JPEG reconstruction data, or a frame index for seeking in animations.

00 00 00 0C  4A 58 4C 20  0D 0A 87 0A                 box size 12, type "JXL ", signature
00 00 00 14  66 74 79 70  6A 78 6C 20  00 00 00 00
             6A 78 6C 20                              box size 20, "ftyp", brand "jxl ", version 0, compatible "jxl "
xx xx xx xx  6A 78 6C 63  FF 0A ...                   "jxlc" box: the whole codestream

Each box is a 4-byte big-endian size, a 4-byte type and the data (a size of 1 means a 64-bit size follows, 0 means “to the end of the file”).

Box Purpose
JXL signature, always first, 12 bytes
ftyp file type, brand jxl
jxll codestream level: 5 (default, for most uses) or 10 (larger images, more channels, higher precision)
jxlc the codestream in one box
jxlp the codestream split into parts, so metadata can be placed between parts
jbrd JPEG bitstream reconstruction data: rebuilds the original JPEG file exactly
Exif Exif metadata (4-byte offset, then TIFF header)
xml XMP metadata
jumb JUMBF metadata (e.g. C2PA content credentials)
brob another box compressed with Brotli (e.g. compressed Exif or XMP)
jxli frame index for seeking in animations

Inside the codestream#

The codestream has a header, then one or more frames. Each frame uses one of 2 modes:

Mode Used for How it works
VarDCT lossy photos, recompressed JPEGs DCT with variable block sizes from 2x2 to 256x256 in the XYB color space (a perceptual space). A recompressed JPEG uses only 8x8 blocks, keeping the original DCT coefficients
Modular lossless, graphics, extra channels integer-only prediction with a context tree (MA tree), reversible color transforms, palettes and the Squeeze transform for progressive decoding

Other coding tools: patches (copy repeated content like text glyphs from a reference frame), splines (smooth curves drawn over the image), noise synthesis (adds film grain at decode time instead of storing it), and two decoder filters (Gaborish and an edge-preserving filter) that reduce blocking and ringing.

The image is split into groups of 256x256 pixels (VarDCT) or 128 to 1024 pixels (Modular), plus a low-resolution 1:8 image (LF) in groups covering 2048x2048 pixels. A table of contents gives the offset of each group, so decoders can decode in parallel, decode only a region, or show a preview from the first bytes of the file.

Limits#

Property Value
Width, height 1 to 1,073,741,823 (230-1) pixels; level 5 allows up to 262,144 per side and 228 pixels in total
Channels gray or RGB, plus extra channels (alpha, depth, spot colors, CMYK black): up to 4 at level 5, up to 4096 at level 10
Bit depth up to 16 bits per sample at level 5; higher integer precision and 32-bit float at level 10
Animation yes, with frame durations, blending and layers

Lossless JPEG recompression#

Shell
cjxl photo.jpg photo.jxl          # lossless JPEG transcoding is the default for JPEG input
djxl photo.jxl restored.jpg       # bit-identical to photo.jpg
cjxl photo.png photo.jxl -d 1     # lossy: distance 1 is visually lossless (default for PNG input)
cjxl photo.png photo.jxl -d 0     # lossless
cjxl photo.png photo.jxl -q 90 -e 7  # quality on a JPEG-like scale, effort 1-10

cjxl, djxl and jxlinfo come with libjxl. The -d (distance) option sets the maximum visual error: 0 is lossless, 1 is visually lossless, 2-3 is good quality for the web. Higher effort (-e) makes smaller files but encodes slower.

Specifications and documentation#

Software that opens JPEG XL files#

SoftwareWindowsmacOSLinuxWebCanNotes
SumatraPDF✓viewfree, open source; also opens JXL inside archives and comic books
Web browsers✓✓✓viewSafari 17+ (partial), recent Chrome and Firefox; check caniuse for current versions. Also on Android and iOS
JPEG XL Image Extension✓viewfree from Microsoft, Windows 11 24H2+; adds JXL to File Explorer thumbnails and Photos
macOS Preview✓view, convertbuilt into macOS 14 and later
GIMP✓✓✓view, edit, create, convertfree, open source
Krita✓✓✓view, edit, createfree, open source; animation and HDR
darktable✓✓✓view, edit, convertfree, open source raw photo editor, JXL import and export
digiKam✓✓✓view, convertfree, open source photo manager
XnView MP✓✓✓view, convertfree for private use
IrfanView✓view, convertfree for non-commercial use, needs the plugins pack
ImageMagick✓✓✓convert, createcommand line, open source
libjxl tools✓✓✓convert, createcjxl, djxl, jxlinfo: reference encoder and decoder
Squoosh✓convertencode JXL in the browser
FFmpeg✓✓✓convertwhen built with libjxl, reads and writes JXL images and animations

Libraries#

Open-source libraries that read and write JPEG XL. See all JPEG XL libraries for a comparison.

C/C++libjxl
C#Magick.NET
JavaJXLatte
Gogen2brain/jpegxl
Pythonpillow-jxl-plugin, pyvips
Rubyruby-vips
Rustjpegxl-rs, jxl-oxide
PHPImagick