HEIC/HEIF: From iPhone to Web
Convert iPhone HEIC photos for web use. Learn about HEIF format, conversion tools, automation strategies, and why you shouldn't serve HEIC directly on the web.
HEIC (High Efficiency Image Container) is the default photo format on iPhones, offering excellent quality at small file sizes. However, it’s not suitable for direct web use. If you’ve ever tried to email an iPhone photo to a colleague on Windows, or upload one to a website that only accepts JPEGs, you’ve already run into the HEIC compatibility problem. This guide covers everything you need to know about handling HEIC files for web projects, including how to convert HEIC to JPG, open HEIC files on any platform, and decide when conversion is actually necessary.
What is a HEIC File?
A HEIC file is a photo saved in Apple’s default image format, used by every iPhone since iOS 11. When you take a picture with your iPhone camera, chances are it gets saved as a .heic file rather than the more familiar .jpg.
So what is HEIC exactly? The name stands for High Efficiency Image Container, and the format was developed to solve a real problem: photos were getting sharper and more detailed with every new phone, but storage space wasn’t keeping up. HEIC compresses images roughly 50% more efficiently than JPEG while maintaining the same visual quality. That means your iPhone can store twice as many photos in the same amount of space.
Beyond the storage savings, a HEIC file carries features that JPEG simply can’t:
- 10-bit color depth for smoother gradients and richer tones, compared to JPEG’s 8-bit limit
- HDR (High Dynamic Range) data that preserves detail in both shadows and highlights
- Live Photos bundled as a still frame plus a short video clip in a single file
- Depth maps captured by the dual-camera system for Portrait Mode effects
- Multiple images in one container, such as burst shots or image sequences
- Non-destructive edits stored alongside the original, so you can always revert changes
The catch is that HEIC was designed primarily with Apple’s ecosystem in mind. While it’s an excellent format for capturing and storing photos on your phone, it creates friction the moment you try to share those photos outside of Apple devices. That’s why knowing how to convert HEIC to JPG or other web-compatible formats is an essential skill for anyone working with images online.
HEIF vs HEIC: What’s the Difference?
You’ll often see the terms HEIF and HEIC used interchangeably, which understandably causes confusion. Here’s how they relate to each other:
| Term | Full Name | What It Is |
|---|---|---|
| HEIF | High Efficiency Image Format | The container format (a specification) |
| HEIC | HEIF with HEVC codec | Apple’s specific implementation of HEIF |
Think of it this way: HEIF is a box, and HEIC describes both the box and what’s inside it. HEIF is the broader standard, defined by the MPEG group, that describes how to package images efficiently. It’s codec-agnostic — meaning any compression algorithm can live inside a HEIF container. HEIC is a specific flavor of HEIF where the image data is compressed using the HEVC (H.265) video codec, which is the same codec used for 4K video streaming.
There’s also a lesser-known variant called HEIF with AV1 codec (sometimes given the .avif extension), which is the open-source alternative that browsers are rapidly adopting. In practical terms:
- HEIF = the general container specification
- HEIC = HEIF + HEVC codec (what iPhones produce, file extension
.heic) - AVIF = HEIF + AV1 codec (what modern browsers prefer, file extension
.avif)
For most people, the HEIF vs HEIC distinction is academic. When someone sends you a .heic file from their iPhone, it’s a HEIF container using HEVC compression. The important thing to know is that HEVC carries patent licensing requirements, which is a major reason why browser vendors (other than Apple) have been reluctant to add native HEIC support. The royalty-free AV1 codec inside an AVIF container avoids this issue entirely, which is why AVIF is becoming the web’s preferred next-generation format.
Why iPhones Use HEIC
Apple adopted HEIC as the default camera format starting with iOS 11 and the iPhone 7 because of the compelling advantages it offers:
| Feature | HEIC | JPEG |
|---|---|---|
| File size | 50% smaller | Baseline |
| Quality | Better at same size | Good |
| 10-bit color | Yes | No |
| HDR support | Yes | No |
| Live Photos | Yes | No |
| Transparency (alpha) | Yes | No |
| Image sequences | Yes | No |
The 50% file size reduction alone is significant. For a phone that stores thousands of photos, this effectively doubles available storage. Apple’s hardware includes a dedicated HEVC encoder chip, so there’s no performance penalty when saving HEIC photos. Combined with the richer feature set, it’s easy to see why Apple made the switch.
Browser Support
Despite its technical merits, HEIC has almost no support in web browsers:
| Browser | HEIC Support |
|---|---|
| Safari (macOS/iOS) | Yes |
| Chrome | No |
| Firefox | No |
| Edge | No |
| Opera | No |
| Samsung Internet | No |
One important nuance: iOS and macOS handle automatic conversion behind the scenes. When you share a HEIC photo via AirDrop, email, or iMessage to a non-Apple recipient, Apple’s sharing system can automatically convert it to JPEG. Similarly, when you use the “Upload” button on a website in Safari on iOS, the system often converts HEIC to JPEG before the upload actually happens. This means many web developers never see HEIC files at all, because iOS silently converts them. However, this automatic conversion doesn’t happen in every scenario (for example, drag-and-drop uploads, third-party file managers, or cloud sync tools like Dropbox or Google Drive), so your server-side code should still be prepared to handle HEIC uploads.
Bottom line: Don’t serve HEIC on the web. Convert to JPEG, WebP, or AVIF.
How to Open HEIC Files
If you’ve received a HEIC file and need to view it, the steps depend on your operating system. Here’s how to open HEIC files on every major platform.
On Windows
Windows 10 and 11 can open HEIC files natively, but you may need to install a free extension first:
- Install the HEIF Image Extensions from the Microsoft Store (free, published by Microsoft)
- Install the HEVC Video Extensions — this is sometimes required for full HEIC decoding. Microsoft offers a paid version ($0.99), but there’s also a free “HEVC Video Extensions from Device Manufacturer” package
- Once installed, Windows Photos, Paint, and File Explorer thumbnails will all recognize
.heicfiles
If you prefer not to install extensions, you can also use free third-party viewers like IrfanView (with the HEIF plugin), XnView, or FastStone Image Viewer.
On Mac
macOS has native HEIC support since macOS High Sierra (10.13). Simply double-click a .heic file, and it will open in Preview. Quick Look (pressing Space in Finder) also works. No additional software or plugins are required.
On Linux
Linux requires additional libraries to handle HEIC files:
# Ubuntu/Debian
sudo apt install libheif-examples
heif-thumbnailer input.heic # For thumbnails
eog input.heic # Open in Eye of GNOME (if libheif is installed)
# Or install the full GIMP HEIF plugin
sudo apt install gimp-heif
For KDE users, installing kimageformats with HEIF support enables thumbnails and previews in Dolphin and Gwenview.
Online Tools
If you just need to quickly view or convert a single HEIC file without installing anything, several online tools work well:
- Squoosh.app (by Google) — drag and drop a HEIC file to view and convert it
- CloudConvert — supports HEIC to JPG, HEIC to PNG, and many other conversions
- iLoveIMG — simple browser-based HEIC conversion
- Convertio — handles batch HEIC conversion in the browser
Keep in mind that uploading photos to online services means your images pass through third-party servers, which may not be appropriate for sensitive or private photos.
Converting HEIC Files
Converting HEIC to JPG is the most common operation, since JPEG remains the universal image format that every device and browser supports. But depending on your needs, you might also want to convert HEIC to PNG (for lossless quality or transparency preservation) or directly to modern web formats like WebP and AVIF.
Command-Line Tools
Using ImageMagick
ImageMagick is the Swiss army knife of image conversion. To convert HEIC to JPG:
# Simple conversion
magick input.heic output.jpg
# With quality control (85% is a good balance of size and quality)
magick input.heic -quality 85 output.jpg
# Convert HEIC to PNG (lossless)
magick input.heic output.png
# Convert and resize in one step
magick input.heic -resize 1920x1080 -quality 85 output.jpg
Using libheif
The libheif library provides dedicated HEIC/HEIF tools:
# Convert HEIC to JPG
heif-convert input.heic output.jpg -q 85
# Convert HEIC to PNG
heif-convert input.heic output.png
# Get info about a HEIC file
heif-info input.heic
Using sips (macOS built-in)
If you’re on a Mac, sips is already installed and handles HEIC natively:
# Convert HEIC to JPEG
sips -s format jpeg input.heic --out output.jpg
# Convert HEIC to PNG
sips -s format png input.heic --out output.png
# Convert and resize
sips -s format jpeg -Z 1920 input.heic --out output.jpg
Using FFmpeg
Since HEIC uses the HEVC codec under the hood, FFmpeg can also handle conversions:
# Convert HEIC to JPG
ffmpeg -i input.heic output.jpg
# Convert HEIC to PNG with maximum quality
ffmpeg -i input.heic -q:v 1 output.png
Node.js Conversion
const heicConvert = require('heic-convert');
const sharp = require('sharp');
const fs = require('fs').promises;
async function convertHeicToWeb(inputPath, outputDir) {
const inputBuffer = await fs.readFile(inputPath);
const jpegBuffer = await heicConvert({
buffer: inputBuffer,
format: 'JPEG',
quality: 0.9
});
const baseName = path.basename(inputPath, '.heic');
await fs.writeFile(path.join(outputDir, baseName + '.jpg'), jpegBuffer);
await sharp(jpegBuffer)
.webp({ quality: 80 })
.toFile(path.join(outputDir, baseName + '.webp'));
await sharp(jpegBuffer)
.avif({ quality: 65 })
.toFile(path.join(outputDir, baseName + '.avif'));
}
Python Conversion
from PIL import Image
import pillow_heif
pillow_heif.register_heif_opener()
def convert_heic(input_path, output_path):
img = Image.open(input_path)
if img.mode in ('RGBA', 'P'):
img = img.convert('RGB')
img.save(output_path, 'JPEG', quality=85)
HEIC to PNG Conversion
While converting HEIC to JPG is the most popular workflow, there are situations where converting HEIC to PNG is the better choice:
- Lossless quality: PNG uses lossless compression, so no detail is lost during conversion. This matters for graphics, screenshots, or images with text.
- Transparency: If the original HEIC file contains an alpha channel (transparency data), PNG preserves it while JPEG cannot.
- Editing workflows: If you plan to edit the image further in Photoshop, GIMP, or another editor, converting to PNG first avoids the double-compression quality loss you’d get with JPEG.
The trade-off is file size. A PNG converted from a HEIC photo will typically be 5-10x larger than the HEIC original and 2-4x larger than a JPEG conversion. For web delivery, PNG is rarely the right final format for photographic content, but it’s an excellent intermediate format during editing.
Quick HEIC to PNG examples
# ImageMagick
magick input.heic output.png
# libheif
heif-convert input.heic output.png
# macOS sips
sips -s format png input.heic --out output.png
# Python
from PIL import Image
import pillow_heif
pillow_heif.register_heif_opener()
img = Image.open("input.heic")
img.save("output.png", "PNG")
// Node.js
const heicConvert = require('heic-convert');
const fs = require('fs').promises;
async function heicToPng(inputPath, outputPath) {
const inputBuffer = await fs.readFile(inputPath);
const pngBuffer = await heicConvert({
buffer: inputBuffer,
format: 'PNG'
});
await fs.writeFile(outputPath, pngBuffer);
}
Batch HEIC Conversion
When you import photos from an iPhone, you’re often dealing with hundreds or thousands of HEIC files at once. Converting them one by one isn’t practical. Here are efficient approaches for batch HEIC conversion.
Bash one-liners
# Convert all HEIC files in a folder to JPG using ImageMagick
for f in *.heic; do magick "$f" -quality 85 "${f%.heic}.jpg"; done
# Same with libheif
for f in *.heic; do heif-convert "$f" "${f%.heic}.jpg" -q 85; done
# macOS: batch convert with sips
sips -s format jpeg *.heic --out ./converted/
# Parallel conversion using GNU parallel (much faster on multi-core machines)
find . -name "*.heic" | parallel -j4 magick {} -quality 85 {.}.jpg
Python batch script
import os
from pathlib import Path
from PIL import Image
import pillow_heif
from concurrent.futures import ProcessPoolExecutor
pillow_heif.register_heif_opener()
def convert_single(heic_path):
"""Convert a single HEIC file to both JPG and WebP."""
try:
img = Image.open(heic_path)
if img.mode in ('RGBA', 'P'):
img = img.convert('RGB')
stem = Path(heic_path).stem
output_dir = Path(heic_path).parent / "converted"
output_dir.mkdir(exist_ok=True)
# Save as JPG
img.save(output_dir / f"{stem}.jpg", "JPEG", quality=85)
# Save as WebP for web use
img.save(output_dir / f"{stem}.webp", "WEBP", quality=80)
print(f"Converted: {heic_path}")
except Exception as e:
print(f"Failed: {heic_path} - {e}")
def batch_convert(directory):
"""Convert all HEIC files in a directory using multiple CPU cores."""
heic_files = list(Path(directory).glob("*.heic")) + list(Path(directory).glob("*.HEIC"))
print(f"Found {len(heic_files)} HEIC files")
with ProcessPoolExecutor(max_workers=4) as executor:
executor.map(convert_single, heic_files)
if __name__ == "__main__":
batch_convert("/path/to/photos")
Node.js batch conversion
const fs = require('fs').promises;
const path = require('path');
const heicConvert = require('heic-convert');
const sharp = require('sharp');
async function batchConvert(inputDir, outputDir) {
await fs.mkdir(outputDir, { recursive: true });
const files = await fs.readdir(inputDir);
const heicFiles = files.filter(f => /\.heic$/i.test(f));
console.log(`Converting ${heicFiles.length} HEIC files...`);
// Process in batches of 5 to manage memory
for (let i = 0; i < heicFiles.length; i += 5) {
const batch = heicFiles.slice(i, i + 5);
await Promise.all(batch.map(async (file) => {
const inputPath = path.join(inputDir, file);
const baseName = path.basename(file, path.extname(file));
const inputBuffer = await fs.readFile(inputPath);
const jpegBuffer = await heicConvert({
buffer: inputBuffer,
format: 'JPEG',
quality: 0.9
});
await fs.writeFile(path.join(outputDir, `${baseName}.jpg`), jpegBuffer);
await sharp(jpegBuffer)
.webp({ quality: 80 })
.toFile(path.join(outputDir, `${baseName}.webp`));
console.log(` Converted: ${file}`);
}));
}
console.log('Batch conversion complete!');
}
batchConvert('./photos', './converted');
Using Sirv for Automatic Conversion
If you’d rather skip manual conversion entirely, Sirv automatically converts HEIC uploads to web-friendly formats:
<img src="https://your-site.sirv.com/photos/vacation.heic?format=optimal">
Sirv handles:
- Automatic HEIC detection and conversion
- On-the-fly conversion to WebP/AVIF based on browser capabilities
- Browser-based format negotiation (each visitor gets the best format their browser supports)
- No manual conversion needed — just upload the HEIC file directly
- CDN delivery for fast load times worldwide
This is especially useful for user-generated content. If your users upload HEIC files from their iPhones, Sirv processes them without requiring any server-side conversion logic.
Handling iPhone Photo Uploads
Server-Side Handler
When building a web app that accepts image uploads from iPhones, you need to be prepared for HEIC files. Here’s a robust server-side handler:
const multer = require('multer');
const heicConvert = require('heic-convert');
const sharp = require('sharp');
const upload = multer({ storage: multer.memoryStorage() });
app.post('/upload', upload.single('image'), async (req, res) => {
let imageBuffer = req.file.buffer;
const mimeType = req.file.mimetype;
if (mimeType === 'image/heic' || mimeType === 'image/heif') {
imageBuffer = await heicConvert({
buffer: imageBuffer,
format: 'JPEG',
quality: 0.9
});
}
const result = await sharp(imageBuffer)
.resize(1600, 1600, { fit: 'inside', withoutEnlargement: true })
.webp({ quality: 80 })
.toBuffer();
await saveToStorage(result);
res.json({ success: true });
});
Note that some iPhones send HEIC files with the MIME type image/heic, while others may report image/heif or even application/octet-stream. It’s a good idea to also check the file extension as a fallback:
const isHeic = mimeType === 'image/heic'
|| mimeType === 'image/heif'
|| /\.heic$/i.test(req.file.originalname)
|| /\.heif$/i.test(req.file.originalname);
When to Keep HEIC vs Convert
Not every HEIC file needs to be converted. Here’s a decision guide:
Keep HEIC when…
- Archiving photos: HEIC offers the best quality-to-size ratio for long-term storage. Converting to JPEG means losing data permanently.
- Staying within Apple’s ecosystem: If the images will only be viewed on iPhones, iPads, and Macs, HEIC works perfectly everywhere.
- Preserving Live Photos: Converting to JPEG strips away the video component of Live Photos.
- Retaining HDR and 10-bit color: JPEG can’t store this data. If you plan to edit in HDR-aware software later, keep the HEIC.
- Storage is a concern: HEIC files are roughly half the size of equivalent JPEGs, so keeping them in HEIC format saves disk space.
Convert HEIC when…
- Publishing to the web: Only Safari supports HEIC. Convert to JPEG, WebP, or AVIF for universal browser compatibility.
- Sharing with non-Apple users: Windows and Android users may not have HEIC support installed by default.
- Uploading to services that don’t support HEIC: Many CMS platforms, social media scheduling tools, and print services only accept JPEG or PNG.
- Email attachments for mixed audiences: JPEG remains the safest choice for ensuring recipients can open your images.
- Print production: Most commercial print shops expect TIFF, JPEG, or PDF files.
Best conversion targets by use case
| Use Case | Best Target Format | Why |
|---|---|---|
| General web use | WebP | Good compression, wide browser support |
| Maximum compatibility | JPEG | Works everywhere, every device, every browser |
| Cutting-edge web optimization | AVIF | Smallest file sizes, growing browser support |
| Editing / intermediate | PNG | Lossless, preserves transparency |
| Archival backup | Keep HEIC | Best quality-to-size, retains all metadata |
HEIC Support in Popular Apps
If you work with images professionally, you’ll want to know which applications can handle HEIC files natively.
| Application | HEIC Support | Notes |
|---|---|---|
| Adobe Photoshop | Yes (CC 2020+) | Full read/write support on macOS; Windows requires HEIF extension |
| Adobe Lightroom | Yes (Classic 8.4+) | Can import and edit HEIC directly, including metadata |
| Adobe Lightroom (cloud) | Yes | Supports HEIC import from mobile devices |
| GIMP | Yes (2.10.2+) | Requires libheif and the gimp-heif plugin |
| Affinity Photo | Yes | Native support on both macOS and Windows |
| Capture One | Yes (12+) | Full HEIC/HEIF import support |
| Figma | No | Convert to JPEG/PNG before importing |
| Canva | Partial | Web version may not accept HEIC; upload JPEG instead |
| WordPress | No (by default) | Requires a plugin or server-side conversion |
| Squarespace | No | Convert before uploading |
| Shopify | No | Convert to JPEG or PNG for product images |
For apps that don’t support HEIC, the simplest workflow is to convert HEIC to JPG before importing. If you need lossless quality for editing, convert HEIC to PNG instead.
File Size Comparison
To give you a sense of how HEIC compares to other formats in practice, here are typical file sizes for a 12-megapixel iPhone photo:
| Format | Size | Quality | Browser Support |
|---|---|---|---|
| HEIC (original) | 1.8 MB | Excellent | Safari only |
| JPEG 85% | 2.4 MB | Good | Universal |
| WebP 80% | 1.2 MB | Good | 97%+ browsers |
| AVIF 65% | 0.8 MB | Good | 92%+ browsers |
| PNG (lossless) | 8-12 MB | Perfect | Universal |
The comparison reveals an interesting pattern: while HEIC is excellent for on-device storage (smaller than JPEG at better quality), both WebP and AVIF can match or beat it for web delivery. AVIF in particular achieves even smaller file sizes than HEIC with comparable visual quality, and it has the added benefit of broad browser support.
Best Practices
1. Never Serve HEIC on the Web
With only Safari supporting HEIC, serving it directly would leave the vast majority of your visitors seeing a broken image. Use the <picture> element to serve modern formats with a JPEG fallback:
<picture>
<source srcset="photo.avif" type="image/avif">
<source srcset="photo.webp" type="image/webp">
<img src="photo.jpg" alt="Description">
</picture>
2. Convert on Upload, Not on Request
Convert images once during upload rather than on every request. This avoids wasting server resources and ensures fast response times. The only exception is when using a CDN like Sirv that caches converted results at the edge.
3. Use a CDN with HEIC Support
CDNs like Sirv handle conversion automatically. Upload the HEIC file, and Sirv serves the optimal format to each visitor based on their browser. This is the lowest-effort approach for teams that don’t want to build their own conversion pipeline.
4. Preserve Metadata When Needed
HEIC files contain rich EXIF data, including GPS coordinates, camera settings, timestamps, and even depth information. When you convert HEIC to JPG or other formats, some of this metadata may be stripped. Use tools like exifr (JavaScript) or piexif (Python) to extract and preserve metadata during conversion if it’s important for your application.
5. Test with Real iPhone Photos
Don’t assume your conversion pipeline works correctly based on synthetic test images alone. Real iPhone photos include edge cases like Live Photos, Portrait Mode depth maps, and burst sequences. Test with actual photos from different iPhone models to catch compatibility issues early.
Conclusion
HEIC/HEIF is great for iPhone storage but requires conversion for web use. The format’s excellent compression and rich feature set make it ideal for capturing and archiving photos, but limited browser support means you should always convert before serving images online.
Here’s the summary:
- Don’t serve HEIC directly — Only Safari supports it, leaving most visitors with broken images
- Convert to WebP/AVIF — Better compression than JPEG with broad browser support
- Automate conversion — Handle HEIC uploads automatically on your server, or use batch tools for offline workflows
- Use CDNs — Sirv converts HEIC on-the-fly with no server-side code needed
- Keep originals for archival — HEIC preserves more data than JPEG, so store the original when quality matters
With proper handling, you can accept HEIC uploads from iPhone users while serving optimized images to all browsers. Whether you choose to convert HEIC to JPG for maximum compatibility, HEIC to PNG for lossless editing, or directly to WebP/AVIF for optimal web performance, the tools and techniques in this guide have you covered.