Choosing the right image format is one of the most impactful — and most misunderstood — decisions in web development. Use the wrong format and you're either inflating file sizes unnecessarily or degrading quality where it matters. Use the right one and your images load faster, look better, and take up less bandwidth.
This guide covers the three formats supported by TinyFication — PNG, JPEG, and WebP — explaining how each works, where it excels, and when you should reach for it.
PNG — Portable Network Graphics
PNG was created in the mid-1990s as a patent-free replacement for GIF, and it has been a web staple ever since. Its defining characteristic is lossless compression: when you compress a PNG, no image data is discarded. Decompress it and you get back the exact original pixels.
What PNG does well
- Transparency (alpha channel). PNG is the go-to format for images with transparent backgrounds — logos, icons, UI elements, stickers. JPEG cannot store transparency at all.
- Sharp edges and flat colour areas. Screenshots, diagrams, infographics, and illustrations with text compress very efficiently as PNG. JPEG creates visible artefacts around sharp edges.
- Lossless archiving. If you need to preserve a master copy of an image that will be edited repeatedly, PNG won't accumulate quality loss with each save.
Where PNG falls short
- Photographs. PNG is a poor choice for photographic content. A 12 MP photo saved as PNG can easily be 8–15 MB. The same image as JPEG at quality 80 is typically 1–2 MB with barely perceptible quality difference.
- File size. Even with compression, PNG files tend to be larger than JPEG for photographic content, because lossless encoding cannot take the same shortcuts that lossy codecs use.
JPEG — Joint Photographic Experts Group
JPEG has been the dominant format for photographic images since the early 1990s. Its lossy compression algorithm works by discarding colour information that the human eye is least sensitive to — a technique based on a mathematical transform called the Discrete Cosine Transform (DCT). The result is dramatically smaller files, at the cost of some image data that can never be recovered.
What JPEG does well
- Photographs and complex imagery. Natural scenes, portraits, landscapes — anything with continuous colour gradients compresses extremely well as JPEG. The lossy algorithm shines here because slight colour inaccuracies in a sunset photo are invisible.
- File size vs quality trade-off. JPEG gives you direct control over this balance via a quality setting (typically 0–100). Quality 80–85 produces excellent results at a fraction of lossless PNG's file size.
- Universal browser and software support. Every device, browser, and image editing application supports JPEG without exception.
Where JPEG falls short
- No transparency. JPEG cannot store an alpha channel. Images with transparent backgrounds must use PNG or WebP.
- Compression artefacts on sharp edges. Text, logos, and line art develop visible blocky artefacts (called "ringing" or DCT blocking) when saved as JPEG, even at high quality settings.
- Generational quality loss. Each time a JPEG is re-saved, it loses a little more quality. Always keep a lossless master copy.
WebP — Web Picture Format
WebP was developed by Google and released in 2010. It supports both lossy and lossless compression, as well as transparency and animation. Designed specifically for the web, it consistently outperforms both JPEG and PNG at equivalent visual quality levels.
What WebP does well
- Better compression than JPEG at the same quality. Google's own research shows WebP lossy files are typically 25–35% smaller than equivalent JPEG files. In practice, the gains vary by image type but are consistently meaningful.
- Transparency with smaller files than PNG. Lossless WebP with transparency tends to be 26% smaller than the equivalent PNG.
- Animation support. WebP can store animated images, like GIF but with far superior compression and quality.
Where WebP falls short
- Slightly less universal support. WebP is now supported by all modern browsers (Chrome, Firefox, Safari, Edge), but older applications — particularly native image editors and some older email clients — may not handle it natively. Check your target audience before committing to WebP-only delivery.
- Not ideal for archival use. For master copies you'll edit later, a lossless PNG is still preferable.
Format Comparison at a Glance
| Feature | PNG | JPEG | WebP |
|---|---|---|---|
| Compression type | Lossless | Lossy | Both |
| Transparency | ✓ Yes | ✗ No | ✓ Yes |
| Best for photos | Poor | Excellent | Excellent |
| Best for graphics / logos | Excellent | Poor | Good |
| Typical file size (photo) | Largest | Medium | Smallest |
| Browser support | Universal | Universal | All modern browsers |
| Supports animation | ✗ No | ✗ No | ✓ Yes |
Practical Recommendations
If you only remember one rule, make it this one: use PNG for graphics with transparency or sharp edges; use JPEG or WebP for everything else.
More specifically:
- Logo on a transparent background: PNG or lossless WebP.
- Hero photograph: JPEG at quality 80–85, or lossy WebP. WebP will be 20–30% smaller.
- Screenshot of a UI or document: PNG. JPEG will blur the text and UI elements.
- Product photos in an e-commerce store: JPEG or WebP. Use WebP if you can serve a JPEG fallback for older browsers.
- Inline blog images: JPEG or WebP at moderate quality — these don't need to be perfect.
- Icons and UI elements: SVG if vector; PNG if raster with transparency.
Pro tip: When serving WebP on a website, use the HTML <picture> element to provide a JPEG fallback for browsers that don't support WebP. This gives you the best of both worlds without sacrificing compatibility.
What About AVIF and JPEG XL?
Two newer formats — AVIF and JPEG XL — offer even better compression than WebP in many cases. AVIF is now supported by all major browsers and can compress photos 30–50% smaller than JPEG. JPEG XL is still rolling out browser support. Both are worth watching, but WebP remains the most practical modern format for broad web use today.
TinyFication compresses PNG, JPEG, and WebP — all in your browser, for free.
Compress your images now →