The basics
What is a JP2 file?
JP2 is the file format of JPEG 2000, an image standard the Joint Photographic Experts Group published in 2000 as a more capable successor to their original JPEG. Instead of cutting the picture into 8 × 8 blocks, it uses a wavelet transform that describes the whole image at several resolutions at once. The same standard covers lossless and lossy compression, very high bit depths, huge images and many colour channels, and lets a reader pull a smaller or lower-quality version out of a file without decoding all of it.
It never replaced JPEG for everyday photos or the web. Encoding and decoding cost more processing power, cameras and browsers stayed with JPEG, and for years the patent position was unclear, although the committee's aim was a royalty-free core. Instead, JPEG 2000 found homes where its features matter more than compatibility:
- Digital cinema. The Digital Cinema Initiatives specification chose JPEG 2000 in 2004, and the films shipped to cinemas as Digital Cinema Packages (DCPs) store every frame as a JPEG 2000 image.
- Libraries and archives. The US Library of Congress holds over 200 million JP2 files, including the scanned pages of its newspaper digitisation programme, and many archives keep lossless JP2 masters.
- Medical imaging. The DICOM standard lets scanners and image archives store images as JPEG 2000, lossless or lossy.
- PDFs and science. PDF can embed JPEG 2000 images, and space missions such as NASA's HiRISE camera on the Mars Reconnaissance Orbiter publish their images as JP2.
Not a JPEG
Despite the name, a .jp2 file is not a JPG and software that reads JPEG can't open it. JPEG XL (.jxl) and JPEG XR (.jxr) are different formats again.
Anatomy
What's inside a JP2 file
There are no sample files on this page, so to show real bytes we saved a small 64 × 48 picture losslessly with Pillow, which uses the OpenJPEG library: 2,396 bytes, against 9,216 bytes of raw pixels. A JP2 file is a series of boxes, each starting with a 4-byte length and a 4-letter type, much like MP4. The picture itself sits in the last box as a JPEG 2000 codestream, a series of markers that each start with an FF byte.
00 00 00 0C 6A 50 20 20 0D 0A 87 0A
00 00 00 14 66 74 79 70 6A 70 32 20 00 00 00 00 6A 70 32 20
offset box / marker bytes contents
000000 jP (signature) 12 "jP " then 0D 0A 87 0A
00000C ftyp 20 brand "jp2 ", minor version 0,
compatible with "jp2 "
000020 jp2h 45 the JP2 header box, holding:
000028 ihdr 22 height 48, width 64, 3 components,
8 bits each, compression type 7
00003E colr 15 method 1: enumerated colour space 16 (sRGB)
00004D jp2c 2,319 the codestream, made of markers:
000055 FF 4F SOC 2 start of codestream
000057 FF 51 SIZ 49 64 × 48, one tile, 3 components of 8 bits
000088 FF 52 COD 14 order LRCP, 1 quality layer, colour
transform on, 3 wavelet levels,
64 × 64 code-blocks, 5/3 wavelet
000096 FF 5C QCD 15 no quantisation (lossless), 2 guard bits
0000A5 FF 64 COM 47 "Example from 99helpers.com/file-types/jp2"
0000D4 FF 90 SOT 12 tile 0, 2,182 bytes from here
0000E0 FF 93 SOD 2 start of the tile's coded data
0000E2 … 2,168 packets of wavelet coefficients
00095A FF D9 EOC 2 end of codestream
end of file at 2,396 bytes- 1
00 00 00 0C 6A 50 20 20 0D 0A 87 0AThe signature box
Length 12, type
jPfollowed by two spaces, then0D 0A 87 0A. Like the PNG signature, the line endings and the byte with its high bit set are there to catch files damaged by text-mode transfers. Every JP2 file starts with exactly these 12 bytes. - 2
66 74 79 70 6A 70 32 20The file type box
ftypwith the brandjp2(with a trailing space) says this is a Part 1 file. A JPX file names the brandjpx, and may listjp2as compatible so that simpler readers can still show it. - 3
ihdr: 00 00 00 30 00 00 00 40 00 03 07 07The image header
Height first, then width: 48 and 64 pixels. Then 3 components, a bit depth stored as 7 (it means 8 bits, unsigned) and the compression type, which is always 7 for JPEG 2000. A reader can learn the image size here without touching the codestream.
- 4
colr: 01 00 00 00 00 00 10The colour specification
Method 1 means a named colour space follows; 16 is sRGB. A JP2 file can instead carry an ICC profile here. Alpha, when present, is described by a separate channel definition box.
- 5
FF 4F FF 51Start of the codestream
SOC, then the SIZ marker with the image and tile sizes and each component's depth. These four bytes are also the signature of a bare codestream: a
.j2kor.j2cfile is just the contents of thisjp2cbox, with no boxes around it. - 6
FF 52 00 0C 00 00 00 01 01 03 04 04 00 01The coding style (COD)
After the marker and its length (
00 0C, 12): style flags 0, progression order 0 (LRCP: layer, resolution, component, position), 1 quality layer (00 01), the colour transform switched on (01), 3 levels of wavelet decomposition, code-blocks of 64 × 64 coefficients (04 04, meaning 2⁶), no special coding options, and transform 1: the reversible 5/3 wavelet, which makes the file lossless. - 7
FF 64 … Example from 99helpers.com/…A comment
The COM marker holds free text. Encoders often write their name and version here; OpenJPEG writes
Created by OpenJPEG version …unless given a comment of its own. - 8
FF 90 … FF 93 …The tile
SOT starts a tile and gives its length, so a reader can skip whole tiles. After SOD come the packets: the coded wavelet coefficients, grouped by resolution and quality layer. A big image can be cut into many tiles, each decodable on its own.
- 9
FF D9End of codestream
EOC closes the codestream, as
FF D9closes a JPEG. Here it's also the end of the file.
Under the hood
How JPEG 2000 compresses an image
- 1Colour transform. RGB is usually converted to brightness and two colour-difference channels: with an exact integer transform for lossless files, or the usual YCbCr-style transform for lossy ones.
- 2Tiles. The image can be cut into rectangular tiles that are coded separately. Small images, like the example above, are a single tile.
- 3Wavelet transform. Each tile is split into a half-size version of itself plus three sets of detail (horizontal, vertical, diagonal). The half-size version is split again, and so on for several levels. The result already contains the picture at 1/2, 1/4, 1/8 of its size: that's where JPEG 2000's resolution scalability comes from.
- 4Quantisation (lossy only). The wavelet coefficients are divided and rounded. Lossless files skip this step and use the integer 5/3 wavelet, so every pixel comes back exactly.
- 5Block coding. The coefficients are cut into code-blocks (often 64 × 64) and coded bit plane by bit plane, most significant first, with an arithmetic coder. This method is called EBCOT.
- 6Packets and layers. The coded data is arranged into packets by resolution, component, position and quality layer. Cutting the stream short gives a lower-quality or smaller image instead of a broken one.
The Library of Congress sums it up as "compress once, decompress many ways": from one master file, a server can send a thumbnail, a screen-sized view or one region at full resolution, decoding only the parts it needs.
What heavy compression looks like
An over-compressed JPEG falls apart into visible 8 × 8 squares. An over-compressed JPEG 2000 image goes soft instead, with blurred textures and faint ripples (ringing) around sharp edges.
Variants
JP2, JPX, J2K and the rest of the JPEG 2000 family
JPEG 2000 is a multi-part standard. The parts you're most likely to meet as files:
| Name | Extensions | What it is |
|---|---|---|
| JP2 (Part 1) | .jp2 | The basic file format: signature, file type, header and one codestream. Colour is limited to sRGB, greyscale, sYCC or a restricted ICC profile. |
| Codestream | .j2k, .j2c, .jpc | The compressed image with no boxes around it, starting FF 4F FF 51. No colour information or metadata. Used inside other formats (DICOM, digital cinema) and for testing. |
| JPX (Part 2) | .jpf, .jpx | Extensions: more colour spaces and transforms, several codestreams, layers, animation and richer metadata. Readers that only know Part 1 may show just the first image, or nothing. |
| JPM (Part 6) | .jpm | Compound documents, such as scanned pages with separate layers for text and pictures. |
| Motion JPEG 2000 (Part 3) | .mj2 | Video in which every frame is a JPEG 2000 image. |
| HTJ2K (Part 15) | .jph | High-Throughput JPEG 2000: a faster block coder, about ten times the throughput for a coded size about 5% larger, and convertible losslessly to and from classic JPEG 2000. |
| JPEG 2000 in HEIF (Part 16) | .heif | JPEG 2000 codestreams stored as items in a HEIF container, brand j2ki. |
Comparison
JP2 vs JPG, PNG, TIFF and AVIF
| JP2 | JPG | PNG | TIFF | AVIF | |
|---|---|---|---|---|---|
| Compression | Lossless or lossy (wavelets) | Lossy | Lossless | None, lossless or lossy | Lossy or lossless |
| Bits per channel | Up to 38 | 8 (usually) | Up to 16 | Up to 16, or 32-bit float | 8, 10, 12 |
| Smaller versions inside the file | Yes, built in | No | No | Optional, as extra images (pyramid TIFF) | No |
| Shown by browsers | No | All | All | Safari only | All current |
| Typical use | Cinema, archives, medical images | Photos to share | Screenshots and graphics | Scans, print, archive masters | Images on websites |
JPEG 2000 remains a sound choice for a lossless master that also needs to be served at many sizes, as in archives and image servers. For anything people will open themselves, convert to JPG, PNG, WebP or AVIF.
On the web
Why browsers don't show JP2 images any more
From Safari 5 onwards, Safari was the only major browser that displayed JPEG 2000, and some image CDNs sent JP2 versions of pictures to Safari users only. Mozilla declined to add it to Firefox in 2009, and Chrome never supported it. Apple's release notes for Safari 18, in September 2024, list one line under Images: "Removed support for JPEG2000." Since then no current browser shows a JP2 file in a page or when it's opened directly.
- On a website: convert to JPEG, WebP or AVIF, or let your CDN choose a format; check it no longer sends JP2 to Safari.
- For zoomable archive images: keep the JP2 masters on the server and let an image server convert on the fly. Servers following the IIIF Image API, such as IIPImage, read JP2 and send JPEG to the browser:
<!-- a lossless JP2 master on the server, a JPEG in the page -->
<img src="https://images.example.org/iiif/3/map-1890.jp2/full/1200,/0/default.jpg"
alt="Town map, 1890">How to
How to open a JP2 file and convert it to JPG or PNG
- On a Mac: double-click to open in Preview, then File > Export to save as JPEG or PNG. Apple's image framework still reads JPEG 2000 even though Safari no longer does.
- On Windows: there's no built-in viewer for JPEG 2000. GIMP, IrfanView (with its plug-ins) and XnView MP open JP2 files and can save them as JPG or PNG.
- On the command line: OpenJPEG, the open-source reference implementation, includes
opj_decompress -i image.jp2 -o image.pngandopj_compress -i image.png -o image.jp2(lossless unless you set a ratio, for example-r 20). With ImageMagick:magick image.jp2 image.png. - In Python: Pillow reads and writes JPEG 2000 through OpenJPEG:
Image.open("image.jp2").save("image.png"). - Inspect one:
opj_dump -i image.jp2prints the boxes and codestream settings: size, tiles, wavelet levels, layers and progression order.
Lossless in, lossless out?
Converting a lossless JP2 to PNG or TIFF keeps every pixel. Converting to JPEG compresses it again and loses a little. Going the other way, re-saving a JPEG as a lossless JP2 makes the file much bigger without improving the picture.
Troubleshooting
Common JP2 problems
- The image is broken or missing in Safari. It used to work: Safari 18 removed JPEG 2000. Serve JPEG, WebP or AVIF instead.
- An app says the file is invalid. It may be a bare codestream (
FF 4Fat the start) renamed to.jp2, or a JPX file using Part 2 features. Check the first bytes, and try OpenJPEG, which reads both. - It's slow to open. Large JPEG 2000 images take far more processing to decode than JPEGs of the same size. Tiled files with several quality layers let a viewer decode only what's on screen; one huge tile doesn't.
- Colours look wrong. The file may use an ICC profile, a colour space only JPX supports, or more than 8 bits per channel that a simple viewer squeezes badly. Convert with a tool that handles colour management.
- A PDF page shows a blank image. The PDF embeds JPEG 2000 through its
JPXDecodefilter (part of PDF since version 1.5) and the viewer lacks a decoder. Try another PDF reader. - Security. JPEG 2000 decoders, OpenJPEG included, have had memory-safety bugs fixed over the years. Keep them updated, and check an uploaded file's declared dimensions before decoding it.
Sample files
There are no sample JP2 files on this page yet. To make one for testing, run magick input.png output.jp2 with ImageMagick, or opj_compress -i input.png -o output.jp2 with OpenJPEG for a lossless file.
Put it online
Have a JP2 file? Give it a link.
Drop a JP2 file on 99helpers and it gets its own web address to share. Browsers can't display JPEG 2000, so anyone who opens the link downloads the file; add a JPEG or PNG copy if people should see the picture straight away.
Questions
JP2 files, frequently asked
What is a JP2 file?
An image in the JPEG 2000 format, which uses wavelet compression instead of ordinary JPEG's 8 × 8 blocks. It can be lossless or lossy, and is used in digital cinema, archives, medical imaging and some PDFs.
How do I open a JP2 file on Windows?
Windows has no built-in viewer for it. Use GIMP, IrfanView with its plug-ins or XnView MP, or convert it with magick image.jp2 image.png.
Can browsers show JP2 images?
Not any more. Safari was the only major browser that did, and Safari 18 removed JPEG 2000 support in 2024. Chrome and Firefox never supported it.
Is JPEG 2000 lossless?
It can be either. With the reversible 5/3 wavelet and no quantisation it's fully lossless; with the 9/7 wavelet and quantisation it's lossy. You can't tell from the extension: opj_dump shows which transform a file uses.
What's the difference between JP2 and J2K?
A .j2k (or .j2c) file is a bare JPEG 2000 codestream. A .jp2 file wraps the same codestream in boxes that add a signature, colour information and metadata.
Is JPEG 2000 better than JPEG?
Technically, in many ways: lossless mode, higher bit depths, no blocky artefacts, and smaller versions built into the file. But it's slower to process and far less widely supported, so JPEG is still the better choice for sharing photos.
How do I convert JP2 to JPG?
On a Mac, open it in Preview and choose File > Export > JPEG. Elsewhere, use GIMP or XnView MP, or the command line: magick image.jp2 image.jpg.
Why does a PDF contain JPEG 2000?
PDF has supported JPEG 2000 images since version 1.5, through its JPXDecode filter. Scanning software and archives use it for compact, high-quality page images.
Related formats
Other file types explained
Keep going
Related
Sources
- Library of Congress: JPEG 2000 JP2 file format description
- JPEG committee: Overview of JPEG 2000
- Apple: Safari 18 release notes (JPEG 2000 removed)
- OpenJPEG: open-source JPEG 2000 codec and reference software
- DICOM PS3.5: JPEG 2000 image compression transfer syntaxes
- Wikipedia: JPEG 2000
Last reviewed 27 October 2026.