Best Image Formats for the Web: When to Use Each
Picking the right image format can cut page weight more than any compression slider. Here's what each format is good at and when to reach for it.

On this page
- Quick answer: which format for which image?
- JPG: the dependable workhorse for photos
- PNG: lossless and transparent
- WebP: the practical modern default
- AVIF: the smallest files, with some trade-offs
- GIF: compatible, but showing its age
- SVG: the format that isn't made of pixels
- How do you serve modern formats with a fallback?
- How should you choose for your own site?
Images are usually the heaviest thing on a web page. And the format you save them in quietly decides a lot: how big the file is, whether it can have a transparent background, whether it can move, and whether it stays crisp on a large monitor. Get it wrong and you can ship a 2 MB PNG where a 150 KB WebP would have looked identical.
There are six formats worth knowing for the web. Each has a job it does well and jobs it does badly.
Quick answer: which format for which image?
If you just want the short version, here it is.
| Image type | Best choice | Fallback |
|---|---|---|
| Photographs | AVIF or WebP | JPG |
| Logos and icons | SVG | PNG |
| Screenshots and UI captures | Lossless WebP or PNG | PNG |
| Graphics needing transparency | WebP or PNG | PNG |
| Short animations | Animated WebP or video (MP4/WebM) | GIF |
| Illustrations with flat colors | SVG if vector, otherwise PNG or WebP | PNG |
The rest of this guide explains why, and how to serve modern formats without leaving anyone behind.
JPG: the dependable workhorse for photos
JPG (or JPEG, same thing) has been around since the early 1990s and is still the most widely compatible photo format in existence. Every browser, phone, email client, operating system and photo printer opens it.
It uses lossy compression tuned for photographs, discarding fine detail the eye is least sensitive to. At quality settings around 75 to 85, photos look essentially untouched at a fraction of the original size.
Where JPG struggles: sharp edges and flat color. Text, logos and screenshots pick up fuzzy halos and blocky artifacts. JPG also has no transparency, so a cut-out product shot saved as JPG ends up on a solid background.
Use it for: photos where compatibility matters most, email images, and as the fallback in a <picture> element.
PNG: lossless and transparent
PNG compresses without losing anything, and it supports a full alpha channel, meaning smooth, partial transparency (soft shadows, anti-aliased edges, semi-transparent overlays).
That makes it great for logos, icons, UI screenshots, diagrams and anything with text. It's also the format most background removal tools output, because a cut-out subject needs a transparent background.
The catch is photographs. Because PNG keeps every pixel exactly, a photo saved as PNG is often several times larger than a good JPG of the same image, with no visible benefit. If you've got photos stored as PNG, converting PNG to JPG is often the quickest way to shrink them.
Use it for: graphics with sharp edges, transparency when WebP isn't an option, and images you'll keep editing.
WebP: the practical modern default
Google introduced WebP in 2010, and it's now supported in all current major browsers. It does both lossy and lossless compression, supports transparency and supports animation. In other words, it can replace JPG, PNG and GIF in most situations.
Lossy WebP is typically noticeably smaller than JPG at similar visual quality, and lossless WebP is usually smaller than the equivalent PNG. Exact savings depend on the image, so test on your own content rather than trusting a single number.
The downsides are mostly outside the browser. Some older desktop software, print services and upload forms still don't accept WebP. If someone downloads your WebP and tries to open it in an old image editor, it might fail. For website delivery, though, it's an easy and safe upgrade. The JPG to WebP converter handles it in your browser.
Use it for: almost every image on a modern website.
AVIF: the smallest files, with some trade-offs
AVIF is based on the AV1 video codec and often compresses even better than WebP, especially at lower file sizes, where it tends to hold up with fewer obvious artifacts. It supports transparency, animation, high dynamic range and wide color gamuts.
Current versions of Chrome, Firefox, Safari and Edge support it, though support arrived later than WebP's, so some slightly older devices may lack it. Encoding is also slower: converting a large batch to AVIF takes noticeably longer than converting to WebP. And editing software support is still catching up.
Use it for: large photos where every kilobyte counts, served with a WebP or JPG fallback. You can test it on your own images with JPG to AVIF.
Tip: Don't assume AVIF always wins. On some images, particularly small ones or those with fine texture, WebP at a sensible quality comes out about the same size or better. Convert one or two representative images and compare.
GIF: compatible, but showing its age
GIF dates from 1987. It's limited to 256 colors per frame, which is why photographic GIFs look grainy and posterized. Its transparency is all-or-nothing: a pixel is either fully transparent or fully opaque, so edges against varied backgrounds look jagged.
GIF survives because of animation and universal support, especially in chat apps and email. But for animation on a website, animated WebP or a short muted video loop is usually many times smaller with much better color. If you do need a GIF, a GIF maker can build one from a set of images.
Use it for: compatibility-critical animations (email, some messaging platforms). Avoid it for static images.
SVG: the format that isn't made of pixels
SVG is different from everything above. Instead of storing pixels, it stores shapes as XML: lines, curves, fills and text. That means it scales to any size with perfectly sharp edges, from a 16-pixel favicon to a billboard.
For logos, icons and simple illustrations, SVG files are often just a few kilobytes. They can be styled with CSS, animated and even changed on hover. Search engines can also read text inside them.
But SVG is the wrong tool for photographs. A photo has no clean shapes to describe, and converting one to SVG either loses detail or produces an enormous file. Also, because SVG is code, treat files from untrusted sources with care, and sanitize user-uploaded SVGs before displaying them on your site.
Use it for: logos, icons, charts and flat illustrations. When a platform won't accept SVG (many social networks and marketplaces don't), export a PNG with SVG to PNG.
How do you serve modern formats with a fallback?
You don't have to pick a single format for everyone. The HTML <picture> element lets the browser choose the first format it understands:
<picture>
<source srcset="hero.avif" type="image/avif">
<source srcset="hero.webp" type="image/webp">
<img src="hero.jpg" alt="Hikers crossing a ridge at sunrise"
width="1600" height="900">
</picture>
The browser reads the sources top to bottom and uses the first type it supports. A current browser gets AVIF; one that supports WebP but not AVIF gets WebP; anything older falls back to the JPG in the <img> tag. The alt, width and height live on the <img>, which is the element actually rendered.
Many content management systems, image CDNs and frameworks do this automatically, either with <picture> or by checking the browser's Accept header and serving the best format from the same URL. If yours does, you only need to upload a high-quality original.
Note: Always keep a high-quality master copy (the original camera file, or a lossless export). Converting from one lossy format to another stacks artifacts, so generate each web format from the master instead of from each other.
How should you choose for your own site?
Start from what the image is, not from what format it happens to be in right now.
- Is it a photo? Use WebP (or AVIF with a WebP or JPG fallback). Resize it to the size it's displayed at, then compress.
- Is it a logo or icon? Use SVG if you have the vector source. Otherwise, a PNG or lossless WebP at 2× the display size.
- Does it need transparency? WebP or PNG. Never JPG.
- Does it move? Consider a short video first, animated WebP second, GIF last.
- Will people download and reuse it (press kits, printable files)? JPG and PNG are friendlier for non-web software.
Format is only half the job. Once you've picked one, size and compression matter just as much. Our guide on how to compress images without losing quality picks up from here, and WebP vs JPG vs PNG goes deeper on the three formats you'll use most. When you're ready to switch formats, the Image Converter runs entirely in your browser, so nothing gets uploaded.
Written by ImgPress Editorial
Our editorial team writes and maintains practical guides on working with images. Articles are reviewed for accuracy and updated when tools or best practices change. Spotted an error? Let us know.
Questions readers ask
What is the best image format for website speed?
For photos, AVIF and WebP usually produce the smallest files at a given visual quality. For logos and icons, SVG is typically smallest and stays sharp at any size. Serving a JPG or PNG fallback covers older browsers.
Is WebP supported in all browsers?
WebP is supported by current versions of Chrome, Edge, Firefox, Safari and Opera, which covers the vast majority of visitors. Very old browsers and some legacy software may not display it, which is why a JPG or PNG fallback is still common practice.
Should I still use GIF for animations?
For anything longer than a short loop, usually not. Animated WebP or a muted, looping MP4 or WebM video is typically far smaller than a GIF with better color. GIF remains useful where wide compatibility matters, such as some email clients and chat apps.


