Web development

Image Formats: JPG, PNG, WebP or GIF? What to Choose and How to Cut File Size

When each format fits, how to change size and quality without losing looks, and why the right images make a site faster.

Image Formats: JPG, PNG, WebP or GIF? What to Choose and How to Cut File Size

Images are usually the heaviest part of a page. So the right format, size and quality directly affect site speed. Here is how to sort it out.

Which format for what

  • JPG suits photographs and pictures with smooth transitions. It does not support transparency.
  • PNG keeps transparency and crisp edges, so it is chosen for logos, icons and screenshots. Photos in PNG are usually much heavier.
  • WebP is a modern format: it supports both lossy compression and transparency and usually gives a smaller file than JPG or PNG at a similar look.
  • GIF is limited to 256 colors. It is used for simple graphics and animations, not for photographs.
  • BMP is an uncompressed format. Old programs need it, but it does not suit websites because of its size.
  • PDF is a document, not just an image: you can gather several photos or scans into it and send them as one file. It is not used as an image format for websites.

Size matters more than format

A phone photo can be 4000 pixels wide, while the page shows it in a block 800 wide. The browser downloads the whole file but displays only part of it. Reduce images to the needed dimensions before publishing, and for high pixel density screens double the size is enough.

Quality: where to stop

For JPG and WebP values of 75–85 usually work well. The weight drops substantially and the difference is barely visible. For important images compare the result with the original and find your own threshold.

Transparency

If you turn a PNG with a transparent background into a JPG, the transparent areas should become white, not black. Also remember that GIF supports only full transparency with no semi-transparent edges.

Privacy

Many online converters upload your files to a server. Photos can contain coordinates and other metadata. It is safer to choose a tool that works in the browser and sends nothing.

Large images slow down the loading of the main page element, which is one of the Core Web Vitals metrics. We wrote about it separately: Core Web Vitals in plain words. Image optimization is one of the simplest and most effective actions for speed.

Try it

We built a free image converter: it converts files between JPG, PNG, WebP, GIF, BMP and PDF, changes size and quality, works in batches and returns the result as separate files, one ZIP or one PDF. Everything runs in your browser. Read how we tested it and which limits we chose in the case study. And if you need optimization of a whole site, see the web development service.

How we help with this

Services related to the topic of this article:

Frequently asked questions

Is WebP always better than JPG?

WebP usually gives a smaller file at similar quality and modern browsers support it. But print, legacy programs and some services still need JPG or PNG.

What JPG quality is enough for a website?

For most photos 75–85 is enough. Lower can show visible artifacts; higher makes the file grow faster than the look improves.

Read next

All blog articles →

Need advice on the topic?

Describe the task: we will suggest where to start and say honestly what you can skip.