Skip to content

High Efficiency Image Container (.heic)

.heic file signature | image/heic

High Efficiency Image Container (HEIC), holding one or more High Efficiency Image File (HEIF)— aka H.265 — images, created using the High Efficiency Video Coding (HEVC) algorithm.Developed by the Moving Pictures Experts Group (MPEG) and adopted by Apple as the standard imagefile format in 2017.

Safe

Magic Bytes

Offset 4
66 74 79 70 68 65 69 63

Sources: Apache Tika, Gary Kessler

All Known Signatures

3 signature variants are documented for .heic files across multiple sources.

Hex Signature Offset Sources
66 74 79 70 68 65 69 63 4 Apache Tika, Gary Kessler
66 74 79 70 68 65 69 78 4 Apache Tika
66 74 79 70 68 65 69 63 66 74 79 70 6D 4 Wikipedia

Extension

.heic

MIME Type

image/heic

Byte Offset

4

Risk Level

Safe

Validation Code

How to validate .heic files in Python

Python
def is_heic(file_path: str) -> bool:
    """Check if file is a valid HEIC by magic bytes."""
    signature = bytes([0x66, 0x74, 0x79, 0x70, 0x68, 0x65, 0x69, 0x63])
    with open(file_path, "rb") as f:
        return f.read(8) == signature

How to validate .heic files in Node.js

Node.js
function isHEIC(buffer: Buffer): boolean {
  const signature = Buffer.from([0x66, 0x74, 0x79, 0x70, 0x68, 0x65, 0x69, 0x63]);
  return buffer.subarray(0, 8).equals(signature);
}

How to validate .heic files in Go

Go
func IsHEIC(data []byte) bool {
    signature := []byte{0x66, 0x74, 0x79, 0x70, 0x68, 0x65, 0x69, 0x63}
    if len(data) < 8 {
        return false
    }
    return bytes.Equal(data[:8], signature)
}

API Endpoint

GET /api/v1/heic
curl https://filesignature.org/api/v1/heic

See the full API documentation for all endpoints and parameters.

Frequently Asked Questions

What is a .heic file?

A .heic file is a High Efficiency Image Container file. High Efficiency Image Container (HEIC), holding one or more High Efficiency Image File (HEIF)— aka H.265 — images, created using the High Efficiency Video Coding (HEVC) algorithm.Developed by the Moving Pictures Experts Group (MPEG) and adopted by Apple as the standard imagefile format in 2017.

What are the magic bytes for .heic files?

The magic bytes for High Efficiency Image Container files are 66 74 79 70 68 65 69 63 at byte offset 4. These bytes uniquely identify the file format regardless of the file extension.

How do I validate a .heic file?

To validate a .heic file, read the first bytes of the file and compare them against the known magic bytes (66 74 79 70 68 65 69 63) at offset 4. This is more reliable than checking the file extension alone, as extensions can be renamed.

What is the MIME type for .heic files?

The primary MIME type for .heic files is image/heic.

Is it safe to open .heic files?

High Efficiency Image Container (.heic) files are generally safe to open. They are classified as low risk because they primarily contain data rather than executable code. However, always ensure files come from a trusted source.