
Image file formats such as JPEG, PNG and WebP are named by the extension at the end of a file name, for example .jpg, .png or .webp. The right one depends on what the picture shows and on whether it needs transparency or animation, because formats differ in how they compress and in what they can hold.
Image file extensions for nine formats in one table
Two files ending in .jpg and .jpeg hold the same JPEG data, because some formats use more than one extension. Lossless files reproduce the original exactly, while lossy files discard image data to get much smaller sizes. The table lists nine formats with their extensions.
| Format | Extensions | How it stores the picture | Best for |
|---|---|---|---|
| JPEG | .jpg, .jpeg | Lossy | Photos and other still images |
| PNG | .png | Lossless | Exact reproduction, transparency |
| GIF | .gif | Lossless, 256-color palette | Simple images and animation |
| WebP | .webp | Lossy or lossless | Stills and animation |
| AVIF | .avif | Lossy or lossless | Stills and animation |
| SVG | .svg | Vector shapes | Icons, diagrams, interface elements |
| HEIF | .heic, .hif, .heif | Less storage than JPEG at the same visual quality | iPhone photos |
| TIFF | .tif, .tiff | Raster, made for scanned photos | Scans; avoid on web pages |
| BMP | .bmp | Raster, mostly on Windows | Special cases only; avoid on web pages |
MDN lists JPEG, PNG, GIF, WebP, AVIF and SVG as the formats most commonly used on the web, and it puts TIFF and BMP among the formats to avoid for web content. HEIF is in the table because iPhones can save photos in it and Windows needs an extra package to open it.
JPEG and PNG have a head-to-head test in JPEG vs PNG: which to use, tested on real images. WebP has its own write-up in What Is the WebP Format? Size, Support, Limits.
"The image file formats that are most commonly used on the web are listed below." / "Good choice for lossy compression of still images (currently the most popular)." / "Vector image format; ideal for user interface elements, icons, diagrams, etc., that must be drawn accurately at different sizes." / "TIFF is a raster graphics file format which was created to store scanned photos, although it can be any kind of image." / "The BMP ( Bitmap image ) file type is most prevalent on Windows computers, and is generally used only for special cases in web apps and content." — from MDNView official source →
"The HEVC Video Extensions package must be installed in order to view images stored in HEIF files that use the .heic, .hif or .heif file extensions." — from MicrosoftView official source →
Raster vs vector, lossy vs lossless: how formats differ
A photo and a logo are stored in different ways, which is why no single recommendation fits every picture. A raster image is made of pixels, so it holds exactly the detail that was captured and nothing more. A vector image is drawn from shapes, so it stays accurate at any size.
Photos are raster, and SVG is the vector format in the table. The second split is about what happens to the data when the file is saved. Lossless compression keeps every bit of the original, and lossy compression throws some away to shrink the file.
Throwing data away costs little on a photograph, because the discarded detail is hard to see. It costs a lot on text and sharp edges, where blurring shows at once. Each format recommendation rests on these two splits.
"Vector image format; ideal for user interface elements, icons, diagrams, etc., that must be drawn accurately at different sizes." / "Photographs and other continuous-tone images can usually tolerate lossy compression, because the discarded detail is harder to see." — from MDNView official source →
Match the image file format to what the picture shows
Content settles the choice: photos tolerate lossy compression, and text and sharp edges do not. MDN sorts its advice for web pages into three groups, which are photos, screenshots and line art, and icons and charts. Photos taken on an iPhone are a fourth case, because a camera setting picks the type before anything is saved.
Photos: WebP or AVIF, with JPEG as the fallback
MDN prefers WebP or AVIF for raster images, because both generally compress better than PNG, JPEG and GIF. JPEG remains a good fallback for photographs. A web page can offer it through the <picture> element, so a browser without WebP or AVIF loads the JPEG instead.
AVIF compresses slightly better than WebP, but it is not quite as well supported in browsers and has no progressive rendering. A page that serves AVIF needs a fallback format with better support.
"For raster images, prefer WebP or AVIF , which generally provide better compression than PNG, JPEG, and GIF." / "JPEG is lossy, so it is often a good fallback format for photographs, while PNG is lossless, making it better for screenshots, diagrams, and line art." / "AVIF offers slightly better compression, but is not quite as well-supported in browsers and does not support progressive rendering." — from MDNView official source →
Screenshots and line art stay sharp in lossless PNG or WebP
Text and sharp edges need a lossless encoding, so screenshots, diagrams, logos and line art keep their detail. Lossy compression leaves blurring and colored fringes around text and sharp edges, and on these pictures the damage is very visible. PNG is lossless, and WebP and AVIF can be lossless too when that setting is chosen at encoding time.
"For screenshots, diagrams, logos, and line art, prefer lossless encoding, as blurring and colored fringes around text and sharp edges are very visible." / "WebP and AVIF support both lossy and lossless compression as a setting you choose when encoding." — from MDNView official source →
Use SVG for icons and charts, or WebP when no vector exists
SVG fits any picture that must stay accurate when it is scaled up or down, such as charts and diagrams. Most icons also exist as vector files, and MDN says to use the SVG version whenever possible. An icon that exists only as pixels goes into WebP, with a fallback as for any other raster image.
"For diagrams, charts, and other images that must be drawn accurately at different sizes, use SVG ." / "Most icons have vector graphics versions, and you should prioritize the SVG version whenever possible. If only raster versions are available, choose WebP but provide fallback like other raster images." — from MDNView official source →
On an iPhone, the Formats setting picks HEIF or JPEG
The Formats setting inside the iPhone Camera settings has two choices. High Efficiency saves new photos as HEIF, which takes less space, and Most Compatible saves them as JPEG. Apple says HEIF uses less storage than JPEG while preserving the same visual quality.
A photo that goes to someone whose app cannot open HEIC should be saved as JPEG first. For what a HEIC file is and when conversion matters, see What is a HEIC file? How it compares with JPG.
"HEIF and HEVC offer better compression than JPEG and H.264, so they use less storage space on your devices and iCloud Photos , while preserving the same visual quality." / "All new photos and videos will now use JPEG or H.264 format. To return to using the space-saving HEIF and HEVC formats, choose High Efficiency." — from Apple SupportView official source →
Need transparency or animation? Use PNG, GIF, WebP or AVIF
A logo with a see-through background or a small moving sticker rules out some formats at once. JPEG has no alpha channel, the data that records transparency, so it cannot keep a transparent background. PNG has full alpha transparency, and MDN names it as the fallback for any image that needs transparency.
| Format | Transparency | Animation |
|---|---|---|
| JPEG | No | No, still images only |
| PNG | Full alpha | As APNG (.apng) |
| GIF | One transparent color | Simple animation |
| WebP | Yes | Yes |
| AVIF | Yes | Yes |
GIF has no true color pixels, and its palette holds at most 256 colors. MDN warns that converting a full color image to GIF can give unsatisfactory dithering, so GIF suits simple pictures only.
WebP and AVIF handle transparency and animation together. For lossless animation MDN also names APNG as a good choice, since GIF is less performant. An AVIF file still needs a fallback format, which the <picture> element can supply.
"JPEG does not support an alpha channel." / "PNG is also the fallback for any image needing transparency, as JPEG has no alpha channel." / "Pixels are opaque, unless a specific color index is designated as transparent, in which case pixels colored that value are entirely transparent." / "GIF does not support true color pixels." / "GIF is a good choice for simple images and animations, although converting full color images to GIF can result in unsatisfactory dithering." / "WebP offers much better compression than PNG or JPEG with support for higher color depths, animated frames, transparency etc." / "Good choice for lossless animation sequences (GIF is less performant)." — from MDNView official source →
JPG vs JPEG, HEIC vs HEIF and AVIF vs WebP: confusing pairs
Three pairs of names cause most of the mix-ups, and in each pair the two names overlap instead of competing. One is a spelling matter, one is a file type and its extension, and one is a trade-off between two good formats.
JPG and JPEG are the same format
MDN lists both .jpg and .jpeg as extensions of JPEG. Nothing differs in the file itself, so either one opens in the same apps.
"Good choice for lossy compression of still images (currently the most popular)." — from MDNView official source →
HEIC is one extension of HEIF
Microsoft names three endings for these files, and all three need the same Windows package. HEIF is the format, and .heic, .hif and .heif are its extensions, so an iPhone photo ending in .heic is a HEIF file.
"The HEVC Video Extensions package must be installed in order to view images stored in HEIF files that use the .heic, .hif or .heif file extensions." — from MicrosoftView official source →
AVIF compresses better, WebP is better supported
MDN lists Chrome, Edge, Firefox, Opera and Safari as supporting each of the two. AVIF gives slightly better compression, while WebP has the wider support, so WebP is the safer single choice and AVIF needs a fallback.
"AVIF offers slightly better compression, but is not quite as well-supported in browsers and does not support progressive rendering." — from MDNView official source →
Change a file format by re-saving the image in a converter
A conversion is a fresh save: the tool reads the picture and writes it out in the type that the destination accepts. Going from PNG to JPEG loses transparency, because JPEG has no alpha channel, so a logo with a see-through background should stay PNG. For converting WebP in particular, see Convert WebP to JPG or PNG, and JPG or PNG to WebP.
A folder of pictures that has to change type at once, such as PNG screenshots that must become JPEG, converts in one pass with the sakuttoAI Bulk Image Converter. The result is the same picture saved again in the new type.
Open .heic photos on Windows with HEVC Video Extensions
A HEIF file stays unreadable until two Microsoft packages are installed. The HEIF Image Extension and the HEVC Video Extensions package together show files ending in .heic, .hif or .heif. Microsoft says .avif files need the AV1 Video Extension package instead.
Converting the photo to JPEG with the sakuttoAI HEIC to JPG converter avoids the extensions altogether. For the missing codec itself, see Open HEIC files on Windows: the missing codec.
"The HEIF Image Extension enables Windows to read and write files that use the High Efficiency Image File (HEIF) format." / "A video extension package must also be installed in order to view images that are stored in the HEIF file." / "The AV1 Video Extension package must be installed in order to view images stored in HEIF files that use the .avif file extension." — from MicrosoftView official source →
Summary: pick the format by what the image shows
Four rules settle most choices without saving a picture in every type to compare. The extension only names the type, so what the picture shows and what it has to do decide the rest.
- Photos go in WebP or AVIF, with JPEG as the fallback.
- Screenshots and line art stay lossless in PNG or WebP, and icons and charts go in SVG.
- A picture that needs transparency goes in PNG, WebP or AVIF, and one that moves goes in GIF, WebP, AVIF or APNG.
- A picture that does not fit its destination is re-saved in a converter, and Windows needs the HEIF Image Extension and HEVC Video Extensions to open .heic files.
FAQ
- Is JPG the same as JPEG?
- Yes. MDN lists both .jpg and .jpeg as extensions of the JPEG format, which is the most popular choice for lossy still images.
- What is an AVIF file?
- An AVIF file stores AV1 image data in the HEIF container and uses the .avif extension. MDN calls it a good choice for both still and animated images, and advises including a fallback format for browsers without support.
- What is the difference between HEIC and HEIF?
- HEIF is the format, and .heic is one of its file extensions. Microsoft names .heic, .hif and .heif as the extensions of HEIF files that need HEVC Video Extensions on Windows.
- Should I use AVIF or WebP?
- MDN rates both as good choices and lists Chrome, Edge, Firefox, Opera and Safari as supporting each. AVIF compresses slightly better, but MDN says it is not quite as well supported and lacks progressive rendering, and that a page using AVIF should include a fallback format.
- What happens to transparency when I convert a PNG to JPEG?
- It is lost, because JPEG has no alpha channel. To keep a transparent background, save the picture as PNG, which MDN names as the fallback for any image that needs transparency.



