JPEG vs PNG vs WebP vs AVIF vs SVG: choosing web image formats

A practical guide to web image formats — when to use JPEG, PNG, WebP, AVIF, SVG and GIF, how transparency and animation work, and how to serve responsive images.

Images are usually the heaviest part of a web page. On many sites they account for more downloaded bytes than all the HTML, CSS and JavaScript combined, and the largest image on screen is often the element that decides how quickly a page feels loaded. Choosing the right format, at the right size, is one of the cheapest performance improvements available.

This guide explains what each common format is good at, where it falls down, and how to put them together so every visitor gets a sharp image that downloads quickly.

The short answer

If you only remember one table, make it this one.

Image typeBest format todayFallback
Photos and complex artworkAVIF or WebPJPEG
Screenshots and flat graphics with textWebP (lossless) or PNGPNG
Logos and iconsSVGPNG
Images that need transparencyWebP, AVIF or PNGPNG
Simple animationsVideo (MP4/WebM) or animated WebPGIF
FaviconsSVG plus ICO/PNGICO

The rest of this guide explains why, and how to make the right call for the images on your own site.

Lossy vs lossless: the one idea that matters

Every raster format (anything made of pixels) is either lossy or lossless.

  • Lossy formats throw away detail your eye is unlikely to notice, to make files much smaller. JPEG is lossy; WebP and AVIF can be either.
  • Lossless formats keep every pixel exactly. PNG is lossless, as are lossless WebP and lossless AVIF.

Photos compress far better with lossy formats, because they contain natural noise and gradients that hide small changes. Screenshots, diagrams and graphics with sharp edges and flat colour often look worse with lossy compression — you see smudges, called artefacts, around text — and can be smaller as lossless files anyway.

Vector formats are a separate category. SVG describes shapes mathematically rather than storing pixels, so it stays sharp at any size.

JPEG: the reliable workhorse

JPEG has been the standard photo format on the web for decades, and every browser, email client, phone and image editor supports it.

Use it for: photos when you need maximum compatibility, such as email newsletters, downloads or systems that don’t accept newer formats.

Strengths:

  • Universal support.
  • Good compression for photographs at sensible quality settings (around 70–85 is a common starting range in most tools).
  • Progressive JPEGs can show a rough preview while loading.

Weaknesses:

  • No transparency.
  • Visible artefacts around sharp edges and text.
  • Generally larger than WebP or AVIF at similar visual quality.

PNG: lossless and transparent

PNG keeps every pixel exactly and supports full transparency (an alpha channel), which is why it became the default for logos, icons and screenshots.

Use it for: screenshots, user-interface graphics, images with text, and anything that must stay pixel-perfect or needs transparency where newer formats aren’t accepted.

Avoid it for: photographs. A photo saved as PNG can be many times larger than the same photo as a good JPEG or WebP, with no visible benefit.

A useful trick: PNG files from design tools are often far from optimal. Running them through an optimiser, or converting flat graphics to lossless WebP, can shrink them noticeably without changing a single pixel.

WebP: the modern default

WebP supports lossy and lossless compression, transparency and animation in one format. Every current major browser supports it, which makes it a safe default for most website images.

Use it for: almost everything on a website — photos (lossy), graphics and screenshots (lossless), and images that need transparency.

Strengths:

  • Typically smaller than JPEG for photos and smaller than PNG for graphics.
  • Transparency in lossy files, which JPEG can’t do.
  • Wide support across browsers.

Weaknesses:

  • Not every desktop app, CMS or email client handles WebP, so keep originals in your usual format.
  • Its maximum dimensions (16,383 pixels on each side) are rarely an issue on the web but can matter for huge panoramas.

You can convert existing images with our image converter, which runs in your browser and never uploads your files.

AVIF: the smallest files for photos

AVIF is based on the AV1 video codec. For photos it often produces the smallest files of any widely supported format at a given visual quality, and it supports transparency, wide colour and high dynamic range.

Use it for: large photos where every kilobyte counts — hero images, product photography and image-heavy galleries.

Trade-offs:

  • Encoding is slow and CPU-intensive, so it is best done once at build or upload time, not on every request.
  • Support is good in current browsers but newer than WebP’s, so serve a fallback.
  • Not every tool can create AVIF yet. Some browsers can’t encode it from a web page, which is why our converter marks it unsupported where that is the case.
  • At very low quality settings, AVIF tends to blur fine texture rather than show blocky artefacts. Check skin, fabric and foliage at the quality you choose.

SVG: perfect for logos and icons

SVG is a text-based vector format. A logo saved as SVG is often only a few kilobytes and looks razor-sharp on every screen, from a phone to a 4K monitor.

Use it for: logos, icons, simple illustrations, charts and diagrams.

Avoid it for: photos. Converting a photo to SVG either produces a huge file or a posterised image.

Things to watch:

  • Security. SVG files can contain scripts. Only accept SVG uploads from trusted people, and sanitise them if users can upload their own.
  • Fonts. Text inside an SVG uses the viewer’s fonts unless converted to outlines, so it may look different on other devices.
  • Optimisation. SVGs exported from design tools often include editor metadata. Optimising them can remove a large share of the file.

When another system insists on a pixel image — an email header, an app store asset or a social profile — use our SVG to PNG converter to export at exactly the size you need.

GIF and animation

GIF is limited to 256 colours per frame and compresses poorly. A short animated GIF can easily weigh several megabytes.

For animation, consider:

  1. Video (MP4 or WebM) with autoplay muted loop playsinline attributes, which is usually far smaller than the equivalent GIF.
  2. Animated WebP or AVIF, when you need an image element rather than a video.
  3. CSS animation, for interface movement such as spinners and transitions.

Remember people who are sensitive to motion: respect the prefers-reduced-motion setting and avoid long, looping animations near text.

Size matters more than format

The best format can’t rescue an image that is far bigger than it needs to be. A 4,000-pixel-wide photo displayed in a 600-pixel card wastes most of its bytes, whatever the format.

Resize to the displayed size

Work out the largest size each image is shown at, then allow for high-density screens. A photo displayed 800 CSS pixels wide looks sharp on a screen with a device pixel ratio of 2 at 1,600 actual pixels. Our viewport checker shows the pixel ratio of the device you are using.

The image compressor resizes and compresses in one step, in your browser.

Serve responsive images

HTML lets the browser choose the right file for each screen. The srcset attribute lists available widths, and sizes tells the browser how wide the image will be displayed:

<img src="/img/team-800.jpg"
     srcset="/img/team-480.jpg 480w, /img/team-800.jpg 800w, /img/team-1600.jpg 1600w"
     sizes="(max-width: 700px) 100vw, 50vw"
     width="1600" height="1067"
     alt="The support team at their desks">

To offer modern formats with a fallback, wrap the image in a picture element:

<picture>
  <source type="image/avif" srcset="/img/hero.avif">
  <source type="image/webp" srcset="/img/hero.webp">
  <img src="/img/hero.jpg" width="1600" height="900" alt="Shop interior">
</picture>

The browser picks the first source it supports, so older browsers simply get the JPEG.

Always set width and height

Width and height attributes (or a CSS aspect-ratio) let the browser reserve space before the image arrives. Without them, text jumps down as images load, which hurts Cumulative Layout Shift. Our aspect ratio calculator helps when you need to work out proportions.

Load the right images first

  • Add loading="lazy" to images below the fold so they load only when needed.
  • Don’t lazy-load the main hero image. Give it fetchpriority="high" instead so the browser fetches it early.
  • Use decoding="async" on large images so decoding doesn’t hold up other work.

These details have a direct effect on Largest Contentful Paint, as explained in our Core Web Vitals guide.

Colour, metadata and privacy

  • Colour profiles. Most web images should be in sRGB. Images in wide-gamut profiles can look dull or oversaturated in software that ignores the profile. Convert to sRGB on export unless you are deliberately using wide colour.
  • Metadata. Photos from phones and cameras carry EXIF data, which can include the camera model, date and GPS location. Strip it before publishing unless you need it. Re-encoding an image through a canvas, as our converter does, removes it.
  • Alt text. Every meaningful image needs a short text alternative that describes what it communicates. Decorative images should have an empty alt="" so screen readers skip them.

A simple workflow for busy teams

You don’t need a complicated pipeline to get most of the benefit.

  1. Keep high-quality originals in a shared folder, in whatever format your designers use.
  2. Export for the web at the largest displayed size times two, in WebP (or AVIF for big photos), with a JPEG or PNG fallback where needed.
  3. Name files descriptively, such as blue-ceramic-mug-350ml.webp rather than IMG_0042.webp. It helps your team and image search.
  4. Add width, height and alt text every time you place an image.
  5. Check the result with PageSpeed Insights or Lighthouse after publishing.

If your site is built on a modern CMS or framework, much of this can be automated: images resized and converted on upload, srcset generated for you, and old originals kept safely. That is the kind of plumbing our web development team sets up so editors never have to think about it.

For definitions of terms like CDN, caching and lazy loading, see our web development glossary.

Frequently asked questions

Is WebP better than JPEG?

For websites, usually yes. WebP typically produces smaller files than JPEG at similar visual quality, supports transparency, and works in all current major browsers. Keep JPEG for places that don’t accept WebP, such as some email clients and older software.

Should I use AVIF or WebP?

Use AVIF for large photos where file size matters most, with WebP or JPEG as a fallback inside a picture element. If you want one modern format with the fewest compatibility surprises, WebP is the simpler choice.

Does image format affect SEO?

Not directly. Search engines index common formats including JPEG, PNG, WebP, AVIF, SVG and GIF. Format affects SEO indirectly through page speed, Core Web Vitals and user experience, and descriptive file names and alt text help image search.

What quality setting should I use?

There is no universal number. Start around 75–85 for lossy JPEG or WebP, compare the result with the original at actual display size, and lower it until you can see a difference, then step back up. Photos with lots of fine texture usually need higher settings than smooth images.

Why is my PNG so large?

PNG is lossless, so photographs and images with gradients or noise produce very large files. Convert photos to WebP, AVIF or JPEG, and run genuine PNG graphics through an optimiser or convert them to lossless WebP.

Let’s build something great.

Tell us what you want to build, who it is for and what it needs to do. We’ll help you define a practical next step.

Start a project