All formats

HEIC / HEIF (High Efficiency Image File Format)

Full nameHigh Efficiency Image File Format (HEIF); HEIC = HEIF with HEVC-coded images
Extensions.heic, .heif, .hif, .heics (sequence)
MIME typeimage/heic, image/heif, image/heic-sequence, image/heif-sequence
Typeraster image container, lossy (HEVC) compression, image collections and sequences
Starts witha ftyp box: ?? ?? ?? ?? 66 74 79 70 (....ftyp) followed by a brand such as heic, heix or mif1
SpecificationISO/IEC 23008-12 (HEIF), ITU-T H.265 (HEVC)
Maintained byISO/IEC JTC 1/SC 29 (MPEG)
Licensethe container is an open standard; HEVC is covered by patents (pools: Access Advance, Via LA, plus individual holders)

HEIF is a container for images, built on the ISO base media file format (the box structure of MP4). HEIC is HEIF whose images are coded with HEVC (H.265), the video codec used for 4K video. It’s the default photo format on iPhones and iPads (since iOS 11) and on many Android phones, Canon and Sony cameras. At the same quality a HEIC photo is about half the size of a JPEG, and it can store 10-bit color, HDR, transparency, depth maps, live photo sequences and several images in one file.

The same container also holds other codecs: AVIF is HEIF with AV1, and there are brands for JPEG, AVC (H.264), VVC (H.266) and uncompressed images. This page covers HEVC-coded files, the .heic files phones produce.

When to use HEIC#

Opening HEIC on Windows#

Windows 10 and 11 decode HEIC through two Microsoft Store packages:

  1. HEIF Image Extensions (free, often preinstalled): the HEIF container.
  2. HEVC Video Extensions (paid, about $1; some PCs come with a free OEM version): the HEVC decoder.

With both installed, File Explorer shows thumbnails and Photos, Paint and other apps that use the Windows Imaging Component (WIC) open .heic. Without the HEVC extension, Photos asks you to install it. Programs that include their own decoder (SumatraPDF, GIMP, XnView MP, ImageMagick) don’t need these extensions.

To avoid the problem on the iPhone side: Settings › Camera › Formats › Most Compatible takes JPEG photos, and Settings › Photos › Transfer to Mac or PC › Automatic converts to JPEG when copying over USB.

Patents and licensing#

HEVC is covered by patents held by many companies, licensed through the Access Advance and Via LA pools and by individual holders. Products that ship an HEVC decoder or encoder may owe royalties, depending on the country and the product. This is why Chrome, Firefox and Edge don’t display HEIC, why Windows sells the HEVC extension separately, and why many open-source projects ship HEIC support only as an optional plugin.

The open-source libraries (libheif, libde265, x265) are available under LGPL/GPL, but their copyright license doesn’t grant patent rights. The HEIF container itself, and AVIF files in it, are not affected by HEVC patents.

File structure#

A HEIF file is a sequence of boxes, the same structure as MP4. Each box starts with a 4-byte big-endian size and a 4-byte type; a size of 1 means a 64-bit size follows. “Full boxes” add a 1-byte version and 3 bytes of flags.

Unlike a video, a still image file is described by items: each image, thumbnail, Exif block or tile is an item with a numeric ID. The meta box lists the items and their properties and says where their data is; the data is in mdat.

00 00 00 18  66 74 79 70        box size 24, "ftyp"
68 65 69 63  00 00 00 00        major brand "heic", minor version 0
6D 69 66 31  68 65 69 63        compatible brands "mif1", "heic"
xx xx xx xx  6D 65 74 61        "meta": item descriptions (hdlr, pitm, iinf, iloc, iref, iprp)
xx xx xx xx  6D 64 61 74        "mdat": HEVC-coded tiles, thumbnail, Exif

Top-level boxes#

Box Purpose
ftyp file type: major brand and compatible brands. Always first
meta all item information for still images (a full box)
moov track information, only for image sequences (.heics, live photos stored as sequences)
mdat media data: the coded images and metadata blocks

Brands#

Brand Meaning
heic HEVC Main or Main Still Picture profile images (8-bit, 4:2:0). The usual iPhone brand
heix HEVC Main 10 or range extensions (10-bit, 4:2:2, 4:4:4)
hevc, hevx HEVC image sequences
heim, heis multi-layer HEVC (e.g. stereo)
mif1, mif2, miaf generic HEIF / MIAF image file, listed as a compatible brand
msf1 generic image sequence
avif, avis AV1 still image and sequence (see AVIF)

Boxes inside meta#

Box Purpose
hdlr handler type pict: this meta box describes pictures
pitm ID of the primary item: the image to show when opening the file
iinf item info: one infe entry per item with its ID and type
iloc item locations: for each item, the offset and length of its data in mdat (or in idat), possibly in several extents
iref item references between items (see below)
iprp item properties: ipco holds the properties, ipma says which properties belong to which item
idat small item data stored inside meta (e.g. the grid descriptor)

Common item types in infe:

Item type Content
hvc1 an HEVC-coded image (a whole image or one tile)
grid a derived image assembled from tiles
iden, iovl derived images: identity (crop/rotate another image), overlay
Exif Exif metadata (4-byte offset, then the TIFF header)
mime XMP and other metadata, with a content type such as application/rdf+xml
tmap tone-mapped derived image (ISO 21496-1 HDR gain maps)

Common item references in iref:

Reference Meaning
dimg the grid (or other derived image) is built from these items
thmb this image is a thumbnail of another
auxl auxiliary image: alpha plane, depth map, or HDR gain map
cdsc this metadata item (Exif, XMP) describes that image

Common properties in ipco:

Property Meaning
hvcC HEVC decoder configuration: profile, level, and the VPS, SPS and PPS parameter sets
ispe image spatial extents: width and height
colr color: ICC profile (prof/rICC) or CICP values (nclx)
pixi bits per channel
irot, imir rotation (multiples of 90°) and mirroring, applied when displaying
clap clean aperture: crop
auxC type of an auxiliary image, e.g. urn:mpeg:hevc:2015:auxid:1 (alpha)

Grid images#

HEVC encoders and hardware decoders work best on limited sizes, so phones store a photo as tiles. An iPhone photo of 4032 x 3024 is typically 48 HEVC images of 512 x 512 (8 columns x 6 rows), each an hvc1 item, plus a grid item that references them with dimg. The grid item is the primary item. Its data (often in idat) is short:

Field Size Meaning
version, flags 1 + 1 bytes flags bit 0: output size fields are 32-bit instead of 16-bit
rows_minus_one 1 byte rows - 1
columns_minus_one 1 byte columns - 1
output_width, output_height 2 + 2 (or 4 + 4) bytes size of the final image; tiles that extend past it are cropped

The tiles share one hvcC property. A decoder decodes each tile, places them left to right, top to bottom, crops to the output size and then applies clap, irot and imir. Orientation in HEIF comes from irot/imir; the Exif orientation tag should be ignored when displaying.

Other content in phone photos#

Converting HEIC#

Shell
heif-dec photo.heic photo.jpg           # libheif tool (called heif-convert in older versions)
heif-enc photo.png -q 50 -o photo.heic  # encode with x265
magick photo.heic -quality 90 photo.jpg # ImageMagick built with libheif
sips -s format jpeg photo.heic --out photo.jpg   # macOS built-in

Converting to JPEG keeps the main image and usually the Exif data, and drops depth maps, gain maps and other auxiliary images.

Specifications and documentation#

Software that opens HEIC files#

SoftwareWindowsmacOSLinuxWebCanNotes
SumatraPDF✓viewfree, open source; has its own decoder, no Windows extensions needed
Microsoft Photos✓view, editbuilt into Windows; needs the HEIF and HEVC extensions
macOS Preview and Photos✓view, edit, convertbuilt into macOS and iOS; export as JPEG or PNG. Also on iOS
Safari✓viewSafari 17+; other browsers don't display HEIC. Also on iOS
GIMP✓✓✓view, edit, create, convertfree, open source; uses libheif
Krita✓✓✓view, edit, createfree, open source
darktable✓✓✓view, edit, convertfree, open source photo editor, HEIF import
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
Adobe Photoshop✓✓view, edit, convertcommercial; on Windows needs the HEVC extension
CopyTrans HEIC✓view, convertfree for personal use; File Explorer thumbnails and right-click convert to JPEG
ImageMagick✓✓✓convertcommand line, open source; needs libheif with libde265
libheif tools✓✓✓convert, createheif-dec, heif-enc, heif-info

Libraries#

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

C/C++libheif
C#LibHeifSharp, Magick.NET
Gogen2brain/heic, libheif (Go)
Pythonpillow-heif, pyvips
Rubyruby-vips
Rustlibheif-rs
PHPImagick