bytekit

JPG, PNG, WebP or AVIF: Which Image Format Should You Use?

Photos, screenshots, logos and upload forms each want a different format. A practical guide to JPG, PNG, WebP, AVIF, SVG, GIF and the HEIC files your iPhone makes.

By Tushar Dowerah · · 6 min read

Save an image and you face a menu of formats: JPG, PNG, WebP, maybe AVIF, GIF or HEIC. Pick the wrong one and you get a blurry screenshot, a 6 MB photo that will not attach to an email, or a file an upload form refuses to accept. Pick the right one and the same picture can be a tenth of the size with no visible difference.

You do not need to understand compression algorithms to choose well. You need to know what each format is good at, and the kind of image you have. This guide covers both.

Lossy and lossless, in one minute

Every image format makes one basic choice.

  • Lossless formats, such as PNG, keep every pixel exactly. Save and reopen the file a hundred times and it is identical. The price is size, especially for photos.
  • Lossy formats, such as JPG, throw away detail your eyes are unlikely to notice, like tiny colour variations in a sky. Files become dramatically smaller, and a quality setting controls how much is thrown away.

Photos are full of subtle noise and gradients, which lossy compression handles beautifully. Screenshots and graphics have sharp edges and flat colours, where lossy compression leaves visible smudges around text, so lossless usually wins there. WebP and AVIF can do both.

JPG: the universal photo format

JPG, also written JPEG (they are the same thing), has been the standard for photos since the early 1990s. Every phone, computer, browser, printer and website understands it.

  • Best for: photos, and anything you upload to a form, send to someone or print.
  • Avoid for: screenshots with text, logos, line drawings, and anything that needs a transparent background.
  • Quality setting: around 75 to 85 gives files several times smaller than 100 with no difference most people can see.

JPG has no transparency. Save a logo with a transparent background as JPG and the transparent area turns solid, usually white or black.

It is also the format nearly every Indian exam, government and job portal requires for photos and signatures. When a form says JPG or JPEG, do not send anything else, even if it looks the same.

PNG: sharp edges and transparency

PNG is lossless and supports full transparency, which makes it the right choice for screenshots, interface mockups, diagrams, charts, text images and logos without an SVG version.

Its weakness is photos. A phone photo saved as PNG is often five to ten times bigger than a good JPG of the same picture, with no benefit you can see. If a PNG on your computer is a photo, it should almost certainly be a JPG or WebP.

WebP: smaller files for the web

Google introduced WebP in 2010 as a modern replacement for both JPG and PNG. It supports lossy and lossless compression, transparency and even animation. Lossy WebP files are typically around 25 to 35% smaller than JPG at similar quality.

Every current browser displays WebP, including Chrome, Edge, Firefox and Safari, so it is an excellent choice for images on your own website or blog. The catch is everything outside the browser: many upload forms, older desktop apps and some printing services still accept only JPG and PNG.

Image CompressorConvert photos and screenshots to WebP, JPG or PNG, compare before and after, and resize, all on your device.

AVIF: the newest and smallest

AVIF is based on the AV1 video codec and often beats WebP by another 20% or more, especially at small file sizes where JPG starts to look blocky. It supports transparency, wide colour and HDR. Chrome, Edge, Firefox and Safari 16 and later can all display it.

AVIF files are slower to create, and support in editing apps, social networks and upload forms is still patchy. Websites that use AVIF usually offer a WebP or JPG fallback with the HTML <picture> element, so older devices still get an image.

SVG, GIF and HEIC

SVG

SVG is not made of pixels at all. It describes shapes with code, so it stays perfectly sharp at any size, from a browser tab icon to a billboard, and is usually tiny. It is the best format for logos, icons and simple illustrations, but cannot store photos.

GIF

GIF dates from 1987 and can only show 256 colours per frame. Its only remaining strength is simple animation that works everywhere. For anything longer than a couple of seconds, an MP4 video or animated WebP is far smaller and looks better.

HEIC: why your iPhone photos will not upload

Since 2017 iPhones have saved photos as HEIC by default, which is about half the size of JPG at similar quality. Unfortunately many websites, Windows computers and almost all government portals do not accept it. You have three easy fixes:

  • On your iPhone, open Settings → Camera → Formats and choose Most Compatible. New photos are saved as JPG from then on.
  • When you pick a photo through Safari’s upload button, iOS often converts it to JPG automatically. Choose Photo Library rather than Browse files.
  • On a Mac, open the photo in Preview and use File → Export, choosing JPEG.

Which format for which job

You haveBest formatWhy
A photo for an exam or job formJPGRequired by almost every portal
A photo for email or chatJPGOpens on every device
Photos on your own websiteWebP or AVIF, with JPG fallbackSmaller files, faster pages
A screenshot with textPNG (or lossless WebP)Keeps text crisp
A logo or iconSVG, or PNG if you only have pixelsSharp at any size, transparent background
A diagram or chartSVG or PNGFlat colours and sharp lines
A short animationMP4 or animated WebPFar smaller than GIF
A scanned documentPDF, or JPG for a single pageForms and offices expect PDF
Photos to archiveThe original from your cameraEvery re-save of a lossy file loses a little more

Have several photos of a document that must go in as one file? Put them in a PDF with JPG to PDF. Need a photo under a strict limit such as 100 KB? The compress to 100 KB page finds the best quality that fits.

Common mistakes

  • “Converting to PNG will improve the quality.” It will not. Detail removed by JPG compression is gone for good. Converting to PNG only stores the damaged version losslessly, in a much bigger file.
  • Re-saving JPGs over and over. Each save of an edited JPG loses a little more detail. Edit from the original and export once at the end.
  • Ignoring the pixel size. A 4000-pixel-wide phone photo shown 800 pixels wide on a web page wastes most of its bytes. Resizing to the size the image will really be shown at usually saves more than switching formats.
  • Changing the extension by hand. Renaming photo.heic to photo.jpg does not convert it. The file inside is still HEIC, and a strict portal will reject it. Always export or convert properly.
  • Forgetting the hidden location data. Phone photos often contain GPS coordinates in their EXIF data. Re-saving or compressing a photo with a tool that strips EXIF, as ByteKit’s compressor does, removes it before you share.

In practice, that leaves a short rule to remember: JPG for photos you share, PNG for screenshots and graphics, WebP or AVIF for your own website, and SVG whenever you have one for a logo. Then make the image only as large as it needs to be.

Written by Tushar Dowerah

Independent software developer from Dibrugarh, Assam, India, coding since 2020 and building ByteKit’s free, private tools. Spotted a mistake or have a question? Send a message.

Keep reading

All posts