About HEIC image files
iPhones save photos as HEIC, and only Safari can display them. iOS usually converts them to JPEG when you pick a photo in a web upload form, but not always (for example, files shared from the Files app). If your app accepts photo uploads, either convert HEIC on the server or reject it with a clear message.
Other types seen for these files:
image/heif
,
image/heic-sequence
. Accept them when reading uploads, but send image/heic yourself.
File signature
HEIC files start with "ftypheic" (or ftypmif1, ftypheix) at byte 4. The extension and the type a browser reports for an upload both
come from the file name, so check these bytes on the server before trusting a file.
Serve .heic with the right Content-Type
Content-Type: image/heic
image/heic heic heif;
AddType image/heic .heic .heif
@heic path *.heic *.heif
header @heic Content-Type "image/heic"
curl -sI https://example.com/file.heic | grep -i '^content-type'
# Content-Type: image/heic
Set the type in code
res.set('Content-Type', 'image/heic');
// Or make the browser download it:
res.attachment('file.heic');
import mimetypes
mimetypes.add_type('image/heic', '.heic') # if your system doesn't know it
mimetypes.guess_type('file.heic')[0] # 'image/heic'
mime.AddExtensionType(".heic", "image/heic")
w.Header().Set("Content-Type", "image/heic")
Accept .heic uploads
<input type="file" accept=".heic,.heif,image/heic">
The accept attribute only filters the file picker; users can still choose another file. Listing the
extension as well as the type matters, because operating systems don’t always report the type you expect.
Related types
More images
.gif , .webp , .ico , .bmp , .tiff . Look up any extension or type with the MIME type lookup.
Sources
Spotted a mistake? Email hello@devtoolsmith.com and we’ll fix it.
Frequently asked questions
What is the MIME type for .heic files?
image/heic. You may also see image/heif, image/heic-sequence, which are older or unofficial; send image/heic. The full header is "Content-Type: image/heic".
Why does my server send the wrong Content-Type for .heic?
Web servers pick the type from the file extension using a table (mime.types in nginx and Apache). If .heic is missing from that table, they send a default such as application/octet-stream or text/plain. Add the mapping as shown on this page, then check the response with "curl -sI".
How can I check that a file really is HEIC?
Look at the first bytes rather than the extension or the type the browser reports, which both come from the file name. HEIC files start with "ftypheic" (or ftypmif1, ftypheix) at byte 4. The MIME type lookup on this site reads them for you when you drop a file on it.