In more detail
HEIF (High Efficiency Image File Format) is a box-based container that can hold single images, bursts, depth maps and Live Photo sequences, plus EXIF metadata. A .heic file is HEIF whose images are compressed with HEVC (H.265). iPhones have saved photos this way by default since iOS 11 in 2017. Compared with JPEG at similar quality, files are often around half the size, and the format supports 10-bit colour and transparency.
Why it matters
Many web browsers, older Windows and Android versions, and some upload forms cannot display HEIC, so a shared photo may arrive as an unreadable attachment. iPhones usually convert to JPEG automatically when sharing or transferring to a computer, and the camera can be switched to "Most Compatible" to shoot JPEG directly. Converting keeps the picture but may drop depth data or Live Photo motion.
Example
Like other HEIF files, a HEIC photo begins with an ftyp box; bytes 4 to 11 usually read ftypheic:
?? ?? ?? ?? 66 74 79 70 68 65 69 63 ....ftypheic
The first four bytes give the box length and vary between files.
Common confusion
AVIF uses the same HEIF container but AV1 compression instead of HEVC.