How to convert a HEIC to Base64 on a Mac
You can do this with B64, on your own machine. Here is how — and the one compatibility question worth answering before you paste a HEIC payload anywhere.
HEIC is what photographs from an iPhone are, unless someone changed a setting. It packs better than JPEG at the same quality, which is why Apple adopted it, and it is understood natively across macOS. Encoding one to Base64 works exactly as any other image does.
This guide covers encoding a HEIC in B64, and the compatibility question that matters at the far end.
The conversion runs in the app, on your Mac. Nothing is uploaded and there is no account, so a picture that should not leave the building does not have to.
Encode a HEIC
Open Encode
Click Encode in the sidebar or press ⌘1.
Load the photo
Drag it from the Finder onto the Encode area, click Choose File… (⌘O), or press ⇧⌘V to encode a copy already on your clipboard.
.heicand.heifare both accepted, and a Live Photo's still image encodes like any other HEIC.Pick the output format
The data URI produced carries
image/heicas its MIME type, which is the accurate declaration for these bytes.Copy or export
Copy (⇧⌘C) or Export… (⌘E).
The compatibility question
Base64 is a faithful representation of whatever file you give it, and this is the case where that cuts both ways. A HEIC encoded to Base64 is still a HEIC. It decodes perfectly — in this app, in Preview, anywhere macOS is doing the reading — but a consumer that does not understand HEIC will not render it just because it arrived as a data URI.
Ask what is going to read it. Browsers and mail clients vary in their HEIC support, and an image/heic data URI in an HTML email is a gamble. For anything that has to work everywhere, export the photo as JPEG or PNG first and encode that instead.
Where a HEIC payload is entirely sensible: anywhere macOS or iOS is at both ends, an archive or a transfer format, a field in your own application, or a case where you specifically want the original file preserved byte for byte rather than a converted copy of it.
What is preserved
Everything. HEIC files carry a great deal — the main image, often a thumbnail, depth data on portraits, EXIF including location, and the colour profile. All of it is in the bytes, so all of it is in the Base64 and comes back on decode.
That thoroughness is worth a thought before embedding one publicly: a HEIC straight from a phone can carry GPS coordinates and a great deal of camera detail.
Checking what you produced
Paste the result into Decode — free, and instant. It reports the format as HEIC, shows the dimensions, and renders the picture. If you expected a JPEG and get HEIC, you have caught the problem before it reached anything that cares.
The Inspector (⌥⌘I) also shows the declared and actual types, and a SHA-256 of the decoded bytes you can compare with the source.
Copying and exporting the result
Copy (⇧⌘C) puts the complete string on the clipboard. Export… (⌘E) writes it to a .txt file. Both always use the whole result, even when a long one is displayed in pages.
If you find yourself doing this often, turn on copy after encoding in B64 ▸ Settings… ▸ General. Dropping the file then is the whole interaction — the result is on your clipboard before you have reached for a shortcut.
A whole camera roll
Drop the folder into Batch (⌘3) and every HEIC in it is encoded in one pass, with anything unsupported listed rather than dropped. How to convert a folder of images to Base64.
Troubleshooting
The payload decodes here but shows nothing in a browser
That is the HEIC support question rather than an encoding problem. Export the photo as JPEG or PNG and encode that version for anywhere with a mixed audience.
The file was refused
Some files with a .heic extension are not HEIC inside. The bytes decide; open the file and check what it actually is.
The result is larger than I expected for a small photo
HEIC files often carry more than the single image you see — thumbnails, depth maps, auxiliary data. All of it is in the file, so all of it is encoded. The Inspector shows the source size, which is where the surprise usually is.
Frequently asked questions
Will a HEIC data URI work in a browser?
It depends on the browser. Base64 carries the file faithfully, so an image/heic data URI is still a HEIC and needs a consumer that understands HEIC. For anywhere with a mixed audience, export the photo to JPEG or PNG first and encode that.
Does B64 convert HEIC to JPEG when encoding?
No. It encodes the exact bytes you give it, so a HEIC stays a HEIC. That is what makes the round trip lossless — but it means the format question is yours to decide before you encode.
Is the location data in my photo included?
Yes, if it is in the file. EXIF, including GPS coordinates, is part of the bytes and is carried into the Base64. Strip it from the photo first if the payload is going somewhere public.
Can I encode a Live Photo?
The still image encodes like any other HEIC. The paired video is a separate file, and would be encoded separately.