Skip to the tool workspace
Browser 143

Handleidingen Images

How to convert between image formats

Which image format to pick and why (JPEG, PNG, WebP, AVIF, HEIC), the one-line commands, and what quietly breaks when you pick the wrong one.

Format conversion is mostly a question of what the file is for. Get that right and the conversion itself is one command.

Pick the destination first

Format Use it for Watch out
JPEG Photographs, universal compatibility No transparency; every save loses a little
PNG Screenshots, logos, anything with transparency or sharp edges Enormous for photographs
WebP Almost everything on the web Some desktop software still cannot open it
AVIF Photos where size matters most Support is broad, not universal; slow to encode
HEIC What your iPhone produced Barely readable outside Apple
SVG Logos and icons that must scale Vector only. A photo cannot become one
TIFF Print and archival Very large

Two rules cover most mistakes. Photographs do not belong in PNG. It is lossless, so it stores JPEG artefacts as though they were detail and the file balloons. Screenshots of text do not belong in JPEG. Lossy compression smears the edges of letters into grey mush.

The direct waysips (macOS) · ImageMagickmacOS · Linux · Windows

For one file, or a folder of the same kind of file, a command beats any interface. On macOS, with nothing to install:

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

ImageMagick works anywhere. It reads the format from the extension:

magick photo.png photo.webp

The conversions people actually need

HEIC to JPEG

The most common one. iPhones shoot HEIC by default, and a lot of software can't open it.

sips -s format jpeg IMG_0001.heic --out IMG_0001.jpg

On Windows or Linux, HEIC support depends on codecs that may not be installed. Here a browser tool that brings its own decoder really is less trouble than fixing the system.

Anything to WebP

The best single change for images on a website:

magick photo.jpg -quality 82 photo.webp

Quality 82 is a good default; WebP holds up better at a given quality number than JPEG does.

PNG to JPEG, and the transparency trap

Transparency becomes black

JPEG has no alpha channel. Converting a transparent PNG to JPEG fills the transparent areas with something, often black, and the result looks broken. Flatten onto a known background first:

magick logo.png -background white -flatten logo.jpg

Quality, and when it does not apply

Lossy formats (JPEG, WebP, AVIF) take a quality number. Lossless ones (PNG, TIFF, BMP) ignore it, because there is no trade-off to make.

  • 90–100: archival. Large files, no visible gain over 85 for most images
  • 80–90: the working range for anything published
  • 60–80: thumbnails and previews
  • Below 60: visible blocking on any photograph
Converting between lossy formats costs quality

JPEG to WebP decodes the JPEG and compresses it again, so the new file carries the old damage plus a little more. The size saving is usually worth it, but convert from the original whenever you still have it.

Converting a folder properly
  1. Work on a copy. Format conversion is not reversible in any useful sense.
  2. Check the batch really is all one kind. One PNG logo hiding among photographs will come out wrong if you apply photo settings to everything.
  3. Convert, then spot-check the most detailed image and anything with transparency.
  4. Keep the originals until you are sure.

Why do this in a browser at all

There are three good reasons, and "it is better than ImageMagick" is not one of them:

  • The format is unusual. PSD, XCF, JXL, camera RAW. Installing a toolchain for one file someone sent you is overkill.
  • The images are private. An upload-based converter puts them on a server. This one decodes and re-encodes in the tab.
  • You want to see what you are getting. A mixed batch is worth checking image by image, and a command line doesn't show you that.

Questions people ask

Which format should I use for photos on the web?

WebP or AVIF, and every current browser reads both. On a real photo we measured at the same visual quality, WebP was only about 12% smaller than JPEG and AVIF about a third smaller; on flat graphics WebP was less than half the size. The measurements are in the guide to making images small for a fast page.

Why did my PNG get huge when I converted from JPEG?

PNG is lossless, so it stores the JPEG's compression artefacts as if they were detail. Converting a photo to PNG almost always makes it bigger and never makes it better.

How do I open a HEIC file from my iPhone?

Convert it to JPEG. On macOS, sips does it. Anywhere else, use a converter. HEIC is efficient but poorly supported outside Apple's world.

Does converting lose quality?

Lossy to lossy does, because JPEG to WebP decodes and re-compresses. Lossless to lossless (PNG to TIFF) does not. Lossy to lossless keeps the damage already done without adding more.

What is AVIF and should I use it?

A newer format, smaller again than WebP, with broad but not universal support. Worth it when size matters most and you can serve a fallback.

Tools in deze handleiding

Alles draait op je apparaat

Alle handleidingen First published 20 jan. 2025