TC
image7 min read

PNG vs JPG vs WebP: When to Use Each Image Format

Why does the same photo weigh 3 MB as a PNG but only 300 KB as a JPG? And why do modern browsers keep pushing WebP? The answer comes down to how each format compresses pixel data — and the trade-offs it makes along the way.


Lossy vs lossless: the fundamental split

Every image format falls into one of two camps. Lossy formats (JPG, WebP lossy) throw away visual information that humans are unlikely to notice. The file gets dramatically smaller, but you can never recover the discarded data. Lossless formats (PNG, WebP lossless, GIF) compress without losing a single pixel — what you put in is exactly what you get out.

Rule of thumb: Use lossy for photographs and complex images. Use lossless for screenshots, diagrams, logos, and anything with text or sharp edges.

PNG: pixel-perfect precision

PNG uses a lossless compression algorithm called DEFLATE (the same one behind ZIP files). Every pixel is preserved exactly, which makes PNG ideal for screenshots, UI mockups, and images with large flat-color areas.

When PNG shines

  • Transparency — PNG supports a full alpha channel (256 levels of transparency per pixel), unlike JPG which has none
  • Text and sharp edges — No compression artifacts around letters or lines
  • Repeated colors — Screenshots with large solid backgrounds compress extremely well

The downside? PNG files are large for photographs. A 12 MP photo can easily be 10+ MB as a PNG because complex color gradients don't compress well with DEFLATE.


JPG: the king of photographs

JPG (also called JPEG) has dominated photo compression since 1992. It works by applying a Discrete Cosine Transform (DCT) to split the image into frequency components, then aggressively discarding high-frequency detail that the human eye is less sensitive to.

At quality 80–85, JPG typically achieves a 10:1 compression ratio with virtually no visible quality loss on photographs. Drop to quality 60 and you get even smaller files, but may notice softness around sharp edges.

JPG's limitations

  • No transparency — JPG has no alpha channel at all
  • Artifacts on text — Compression creates visible “ringing” around sharp edges and small text
  • Generational loss — Every time you re-save a JPG, quality degrades further

WebP: the best of both worlds

Developed by Google, WebP supports both lossy and lossless compression, plus transparency and animation — all in one format. Lossy WebP is typically 25–35% smaller than equivalent-quality JPG, while lossless WebP beats PNG by around 26%.

WebP is supported in all modern browsers (Chrome, Firefox, Safari, Edge). The only reason not to use it is legacy software compatibility — some older image editors and email clients still don't handle WebP.

AVIF: the future contender

AVIF, based on the AV1 video codec, pushes compression even further — roughly 50% smaller than JPG at equivalent quality. Browser support is growing fast, but encoding is significantly slower than WebP, making it better for pre-processed assets than real-time conversion.


Format comparison

Here's how the major formats stack up:

FormatCompressionTransparencyAnimationBest For
PNGLosslessYes (alpha)NoScreenshots, logos, UI
JPGLossyNoNoPhotos, gradients
WebPBothYes (alpha)YesWeb images (all types)
GIFLossless1-bit onlyYesSimple animations
AVIFBothYes (alpha)YesNext-gen web delivery

File size in practice

The same 1920×1080 photograph saved in different formats shows dramatic size differences:

Same photo (1920x1080, 24-bit color):

PNG  (lossless)    →  4,200 KB
JPG  (quality 85)  →    380 KB
WebP (quality 85)  →    270 KB
AVIF (quality 85)  →    190 KB

Same screenshot (1920x1080, flat colors):

PNG  (lossless)    →    120 KB
JPG  (quality 85)  →    210 KB  ← actually bigger!
WebP (lossless)    →     88 KB

Notice the reversal with screenshots: JPG is larger than PNG for flat-color images because DCT compression is designed for continuous-tone photographs, not sharp edges and solid blocks.


Which format should you choose?

  • Photos for the web — WebP with JPG fallback. Use AVIF if your toolchain supports it.
  • Screenshots and diagrams — PNG, or lossless WebP for smaller files.
  • Logos and icons — SVG when possible (vector), PNG when you need a raster version.
  • Short animations — WebP or AVIF over GIF. GIF is limited to 256 colors and produces enormous files.
The best image format is the one that delivers the smallest file at acceptable visual quality for your specific content. There is no universal winner — only the right tool for the job.

Try it yourself

Put what you learned into practice with our Image Converter.