JPG vs PNG: which format should you use?
JPG and PNG are the two most common image formats on the web, but they solve different problems. JPG uses lossy compression tuned for photographs, producing much smaller files at the cost of some pixel-level detail. PNG uses lossless compression and supports transparency, making it the right choice for logos, screenshots, and any image with sharp edges or flat colour blocks.
Head-to-head comparison
| Aspect | JPG | PNG |
|---|---|---|
| Compression | Lossy (throws away detail) | Lossless (preserves every pixel) |
| Typical file size | Small (2-5 MB from a 24 MP camera) | Large (10-25 MB same source) |
| Transparency (alpha) | No — flattens to background | Yes — 8-bit alpha |
| Colour depth | 24-bit (16.7M colours) | 24-bit or 48-bit |
| Best for | Photographs, web images | Screenshots, logos, UI, diagrams |
| Worst for | Text, sharp edges, transparency | Photographs (files get huge) |
| Browser support | Universal (since ~1995) | Universal (since ~1996) |
| Editing quality loss | Each save = more artifacts | None — infinite edits, no loss |
When to use each
Use JPG when
- The image is a photograph and file size matters (web, email, upload forms)
- Nobody needs to edit it further — final delivery, not source
- Transparency is not required
- You need the smallest possible file that still looks good
Use PNG when
- The image contains text, sharp edges, or flat colour areas
- You need transparency — logos, UI elements, product mockups
- The image will be edited or resaved multiple times
- Quality matters more than file size (design tools, archival)
The verdict
Use JPG for photographs shipped to the internet. Use PNG for everything else — screenshots, logos, illustrations, anything with edges. The one trap people hit: converting a low-quality JPG to PNG doesn't rescue the quality, it just makes a bigger file with the same JPG artifacts baked in.
What actually happens inside each format
How JPG compression works
JPG splits an image into 8×8-pixel blocks, converts each block from RGB to YCbCr (luminance + two chroma channels), applies a Discrete Cosine Transform to separate low-frequency detail from high-frequency noise, and then quantises the result — rounding small coefficients to zero. That quantisation step is where data is permanently discarded. At quality 85 (a common default), a 4000×3000 photograph typically compresses from ~36 MB of raw pixel data down to 2–4 MB. Drop to quality 60 and you'll hit 500 KB–1 MB, but text and sharp edges start showing visible ringing artifacts around high-contrast boundaries.
How PNG compression works
PNG runs each row through a prediction filter (Sub, Up, Average, or Paeth) to reduce redundancy, then feeds the result through DEFLATE — the same lossless algorithm used in ZIP files. Because no data is discarded, a PNG of that same 4000×3000 photograph will be 15–25 MB. However, for images with large flat-colour regions (a screenshot, a diagram, a logo on a white background), the filter + DEFLATE combination is extremely efficient — a 1920×1080 screenshot with mostly text and UI elements often compresses below 300 KB, smaller than a JPG of the same image would be.
File size comparison on real images
We converted the same source images to both formats at typical settings. A 24 MP smartphone photo: 3.2 MB as JPG (quality 85), 22.4 MB as PNG — JPG is 7× smaller. A 1080p desktop screenshot with text: 245 KB as PNG, 410 KB as JPG (quality 90) — PNG is actually 40% smaller because the flat-colour regions compress better with lossless prediction than with DCT. A logo on a transparent background: only possible as PNG (or WebP), since JPG has no alpha channel at all.
What about WebP and AVIF?
WebP (by Google, 2010) and AVIF (from the AV1 video codec, 2019) both offer smaller files than JPG and PNG at the same visual quality. WebP supports lossy, lossless, and transparency modes — it's essentially a better version of both formats in one container. AVIF pushes compression even further but encodes more slowly. As of 2026, both are supported in all major browsers. For new web projects, WebP is the pragmatic default. JPG and PNG remain the safe choices when you need universal compatibility outside the browser — email attachments, office documents, print workflows, and any software that hasn't adopted the newer formats.
Frequently asked questions
Does converting JPG to PNG improve image quality?
Is PNG always bigger than JPG?
Which format should I use for a website hero image?
Can JPG files have transparent backgrounds?
Why do screenshots look blurry when saved as JPG?
What JPG quality setting should I use?
Should I use JPG or PNG for printing?
What's the difference between JPG and JPEG?
Ready to convert?
Last reviewed: Sept. 12, 2026