Skip to content

Convert HEIC to JPG From the Command Line

By Convert HEIC To JPG Editorial Team ·

On a Mac, the built-in sips command converts HEIC to JPG with no installation. On Linux, use heif-convert from the libheif tools. On any system, ImageMagick can do it if it was built with HEIC support. If you would rather not use a terminal, the converter on this site needs no setup. All three can process a whole folder in one loop. This guide gives working commands for each, shows how to keep quality high, how to preserve or strip metadata, and how to avoid overwriting your originals. If you'd rather not use a terminal, the browser converter does the same job with a drag and drop.

Before you start: protect your originals

A mistyped command can overwrite files. Work on copies, or write output to a different folder. Every example below creates a separate jpg folder first:

mkdir -p jpg

Start by testing a single file. Check that the result opens and looks right, then run the loop.

Which tool should you use?

ToolRuns onInstallKeeps metadata by default
sipsmacOSAlready installedGenerally yes
heif-convertLinux, macOSlibheif tools packageDepends on version; check the output
ImageMagickLinux, macOS, WindowsNeeds a build with HEIC supportYes, unless you add -strip

Behaviour differs between versions, so treat the metadata column as a starting point and always inspect a converted sample if the capture date or location matters to you.

macOS: sips

One file, at 90% quality. Guides disagree about exactly how formatOptions maps to quality, and sips also accepts named levels such as low, normal, high and best, so run a quick test on one photo and compare the result before processing a folder:

sips -s format jpeg -s formatOptions 90 photo.heic --out photo.jpg

A whole folder of HEIC files, written to the jpg folder:

for f in *.heic; do
  sips -s format jpeg -s formatOptions 90 "$f" --out "jpg/${f%.heic}.jpg"
done

The quotes around "$f" matter. Without them, file names containing spaces break the command. If your extensions are uppercase (.HEIC), adjust the pattern or run the loop twice.

Linux: heif-convert

Install the tools with your package manager. On Debian and Ubuntu the package is usually libheif-examples; on Fedora, libheif-tools. Names vary by distribution, so search your package list if these don't exist. The -q option takes 0 to 100, defaults to 92 when omitted, and applies only to JPEG output; the output format is chosen by the file extension. Newer libheif releases rename the toolheif-dec, so if heif-convert is missing, try that. Then:

heif-convert -q 90 photo.heic jpg/photo.jpg

And for a folder:

for f in *.heic; do
  heif-convert -q 90 "$f" "jpg/${f%.heic}.jpg"
done

If a HEIC file contains more than one image, such as a burst, heif-convert may write several output files with numbered names. That is expected and is the one case where you'll see more files out than in.

Any system: ImageMagick

ImageMagick can read HEIC when it was compiled with libheif. Check with magick -list format | grep -i heic. If nothing appears, your build can't do it and you should use one of the other tools. When it works:

magick photo.heic -quality 90 photo.jpg

For a folder, using ImageMagick's batch mode, writing into jpg/:

magick mogrify -path jpg -format jpg -quality 90 *.heic

Careful: mogrify without -path or -format can modify files in place. The command above is safe because it writes new files elsewhere. On Windows PowerShell, a simple loop works:

New-Item -ItemType Directory -Force jpg | Out-Null
Get-ChildItem *.heic | ForEach-Object { magick $_.FullName -quality 90 "jpg\$($_.BaseName).jpg" }

Older ImageMagick versions use convert instead of magick. On a current install, magick is the preferred command.

Choosing the quality number

The numbers above use 90, which suits most photos. Lower values (70 to 80) give smaller files for email and uploads; 100 gives the closest match at a larger size. The scales differ slightly between tools, so don't expect identical file sizes. We cover the trade-offs in how to reduce a photo's file size.

Picking a value by testing

If you are unsure which number to use, convert one representative photo three times, for example at 70, 85 and 95. Compare the file sizes and look at each result at full zoom on an area with detail. Choose the lowest value that still looks right to you, then use it for the whole batch.

Keeping or removing metadata

Capture date, camera model and GPS location live in the metadata. If you want them kept, convert, then compare a sample with a tool such as exiftool (a separate, free program) by running exiftool photo.jpg and checking the date and GPS fields. If a tool dropped them, exiftool can usually copy them across from the original:

exiftool -TagsFromFile photo.heic -all:all photo.jpg

If you want them removed for privacy, add -strip to an ImageMagick command, or use exiftool -all= photo.jpg. More options are in how to remove location data from photos. Our own browser converter removes metadata by design.

Speeding up big folders

Converting thousands of photos one at a time is slow. On macOS and Linux you can run several conversions in parallel with xargs. This example uses four processes and ImageMagick:

ls *.heic | xargs -P 4 -I{} sh -c 'magick "{}" -quality 90 "jpg/$(basename "{}" .heic).jpg"'

Pick a number of parallel jobs no higher than your CPU cores. Very large photos use a lot of memory per process, so lower the number if the machine slows down. This pattern assumes file names without unusual characters such as quotes or newlines.

Common problems

  • “no decode delegate for this image format”: your ImageMagick lacks HEIC support. Use sips or heif-convert, or install a build that includes libheif.
  • Nothing happens in the loop: the extension might be uppercase or different (.heif, .HEIC). List the folder and adjust the pattern.
  • Output is rotated wrongly: check one sample in an image viewer. If orientation is wrong, try a different tool, and keep your originals while you test.
  • Colours look flat: some tools drop the colour profile. Compare against the original on a trusted viewer before processing a large batch.

Windows: a practical route

Windows has no built-in HEIC converter command, and installing ImageMagick with HEIC support can be fiddly. Two workable options: install the Windows Subsystem for Linux, add the libheif tools inside it, and use the Linux commands above on your Windows folders (which appear under /mnt/c/...); or use the browser converter, which needs no setup at all. For one-off jobs the browser is quicker than installing a Linux environment, and it processes files locally in the same way. See the Windows page for the non-technical routes.

Scripting tips for messy folders

  • Mixed-case extensions. Cameras and apps produce .HEIC and .heic. In bash,shopt -s nocaseglob makes patterns case-insensitive for the loop.
  • Subfolders. Use find . -iname '*.heic' to include them, and decide how to keep the folder structure in the output.
  • Name collisions. Two files with the same name in different folders would overwrite each other if written to a single output folder. Write each result next to its source or add the folder name.
  • Log what you did. Redirect output to a file so you can see which conversions printed warnings.

Checking the results of a big batch

After a large run, confirm that nothing was skipped. A simple count comparison on macOS or Linux:

ls *.heic | wc -l
ls jpg/*.jpg | wc -l

The two numbers should match, except when burst files produced extra outputs. To find files that failed, list the HEIC files that have no JPG with the same name:

for f in *.heic; do [ -f "jpg/${f%.heic}.jpg" ] || echo "missing: $f"; done

Open a few outputs from the start, middle and end of the folder. Zero-byte files are a sign of a failed conversion, which you can list with find jpg -size 0.

Keeping the original file dates

Conversion creates new files, so their modified date is the time you ran the command, which scrambles anything sorted by date. Copy the original timestamp across with touch -r:

for f in *.heic; do touch -r "$f" "jpg/${f%.heic}.jpg"; done

This restores the file-system date, which many programs fall back on when the embedded capture date is missing. If you need the embedded capture date and GPS data as well, use the exiftool approach shown earlier.

No terminal needed: Shortcuts and Quick Actions

If you like automation but not typing commands, Apple's Shortcuts app includes an action for converting images that can be run on a selection of files, and Finder Quick Actions offer a similar one-click route on recent versions of macOS. These options are slower to set up than a one-line command but easier to reuse, and they keep the process entirely on your own machine. Menu names change between versions, so search for the word “image” when building the shortcut.

Privacy and safety notes

  • Command-line tools run locally and do not upload your photos, like our browser converter. Be wary of scripts you find online that call web services, because those do send your files.
  • Install software from your operating system's official package sources or the project's own site, and read what a script does before running it, especially one that deletes or overwrites files.
  • Test on a copy of a handful of photos before touching a library you cannot easily recreate.

When a terminal is overkill

For a few dozen photos, a drag and drop in the converter is quicker than writing and testing a loop, and it works the same on Windows, Mac, Linux and phones. The terminal earns its place for very large libraries, for repeatable scripts, and when you want to keep metadata intact. The main guide compares all the methods side by side.

Questions people ask

Is converting with sips lossless?

No. JPG is a lossy format, so the result is a recompressed version of the HEIC. The formatOptions value sets the quality, and higher values keep more detail at the cost of a larger file.

Can I convert to PNG or WebP with these tools?

PNG, yes: for example sips -s format png, heif-convert photo.heic photo.png, or magick photo.heic photo.png. WebP depends on the tool and its build, so test on one file first.

Do these commands handle .heif files and AVIF?

HEIF files usually work with the same commands. AVIF support depends on the version and build of each tool, so check your installation before running a large batch.

Is the command line faster than the browser converter?

For a few photos the browser is quicker because there is nothing to set up. For thousands of files, a script that runs several conversions in parallel can finish sooner and can be repeated exactly.

Last reviewed: 2026-11-16