DEV Community

ZahrionTech
ZahrionTech

Posted on

How to Convert HEIC to JPG in the Browser (No Uploads, 100% Private)

What is HEIC, and why does it exist?

HEIC (High Efficiency Image Container) is the default photo format on iPhones since iOS 11. Built on the HEVC/H.265 codec, it stores photos at roughly half the file size of JPEG at similar quality, and a single HEIC file can even hold live photos, bursts, and depth data.

The problem is compatibility. Many Windows PCs, older Android phones, and plenty of web services still can't open HEIC files. Browser support is patchy as well: Safari handles HEIC natively, but Chrome and Firefox generally don't. So converting HEIC to JPG remains a daily chore for a lot of people.

A small client-side approach in JavaScript

The cleanest pattern for an in-browser converter is a short pipeline:

  1. Let the user pick a file with an <input type="file"> (accept .heic).
  2. Decode the HEIC bytes to a bitmap (with a WASM HEVC decoder, e.g. via a library like heic2any).
  3. Paint the bitmap onto a <canvas>.
  4. Re-encode as JPEG with canvas.toBlob('image/jpeg', quality) and offer the download.
async function convertHeicToJpg(file) {
  // 1. Decode HEIC to an ImageBitmap using your chosen decoder
  const bitmap = await decodeHeic(file);

  // 2. Paint it onto a canvas
  const canvas = document.createElement('canvas');
  canvas.width = bitmap.width;
  canvas.height = bitmap.height;
  canvas.getContext('2d').drawImage(bitmap, 0, 0);

  // 3. Re-encode as JPEG at 90% quality
  return new Promise((resolve) =>
    canvas.toBlob(resolve, 'image/jpeg', 0.9)
  );
}
Enter fullscreen mode Exit fullscreen mode

Because everything runs in the page, the photo never leaves the user's device: no uploads, no server-side copies, no waiting in an upload queue.

Don't want to build it yourself?

If you just need a quick conversion rather than your own implementation, try its free HEIC to JPG converter: drop a photo on the homepage, convert it in the browser, and download the JPG. No signup and no uploads — files stay on your machine, exactly like the client-side pipeline above.

That's the part worth remembering: whenever a tool can do the work locally in your browser, there's no reason to hand your photos to a server first.

Top comments (0)