How to convert HEIC to Base64
- Drop a
.heicor.heiffile on the box or pick it with the file picker. - Output as starts on Plain Base64. Switch to Data URI or JSON if your destination needs the MIME type attached.
- Press Copy output or Save as .txt.
The info line shows the MIME type your browser assigned. If the photo came from an iPhone through a share sheet or a cloud service, check that line: some routes hand over a JPEG copy instead of the original HEIC, and then the type reads image/jpeg.
Why HEIC does not display in most browsers
HEIC stores a photo compressed with HEVC (H.265) inside a HEIF container. It gives small files at high quality, which is why iPhones use it by default. Browser support never followed: according to current compatibility data, Safari 17 and later display HEIC, while Chrome, Edge, Firefox and Samsung Internet do not.
So the preview on this page works in Safari and shows a broken image elsewhere. The Base64 is correct either way; the browser just cannot draw it. The same applies to the resize and convert options available for other image types. They need the browser to decode the picture, so they are not offered here.
When Base64 HEIC is the right thing
- Archiving or syncing the original: if a system stores the photo as Base64 in a database or a JSON export, keeping the HEIC preserves the full quality and the small size.
- APIs that accept HEIC: some image and document APIs take HEIC directly. Many accept only JPEG, PNG, GIF and WebP, so check the list of supported types before sending.
- Apple-only targets: an internal page that only ever opens in Safari can use a HEIC data URI.
For a web page, an email or a generic image API, convert to JPEG first: on a Mac, open the photo in Preview and use Export; on an iPhone, setting Camera > Formats to Most Compatible makes future photos JPEG. Then encode the result with JPG to Base64, where you can also resize it and strip location data.
HEIC in Base64
HEIC files start with an ftyp box, like AVIF and MP4. The brand tells you what is inside:
| Brand | Base64 (with a 24-byte ftyp box) |
|---|---|
heic | AAAAGGZ0eXBoZWlj |
heix | AAAAGGZ0eXBoZWl4 |
mif1 | AAAAGGZ0eXBtaWYx |
The fifth character depends on the box size, so match from character 9: eXBoZWlj means a HEIC still image. The JSON output uses image/heic or image/heif as the type, depending on what your browser reports. If it reports nothing, a .heic file gets image/heic from its extension and a .heif file gets application/octet-stream; edit the type by hand if the receiver checks it.
FAQ
Can I use a HEIC data URI in an img tag?
Only for Safari 17 and later on macOS and iOS. Chrome, Edge and Firefox do not decode HEIC and show a broken image. Use JPEG, PNG or WebP for anything other people will open.
Does this tool convert HEIC to JPEG?
No. Browsers outside Safari cannot decode HEIC, so the page encodes the original file as it is. Convert the photo to JPEG on your phone or computer first, then use JPG to Base64.
How do I make my iPhone save JPEG instead of HEIC?
In Settings, open Camera, then Formats, and choose Most Compatible. New photos are then saved as JPEG; existing HEIC photos stay as they are.