JPG vs PNG vs WebP: Which Image Format Should You Use?
Three image formats cover almost every image you'll upload, save, or post: JPG (also called JPEG), PNG, and WebP. They look identical at a glance, but their internal mechanics are very different and picking the wrong format can mean either a blurry image or a 5 MB file where a 100KB one would have done the same job. This guide explains how each format works, when to use it, and what the realistic file-size differences look like.
The short version
- JPG/JPEG: best for photographs and anything with smooth gradients. Smaller than PNG, slightly larger than WebP.
- PNG: best for screenshots, logos, line drawings, and any image that needs transparency or has sharp edges.
- WebP: best for the web when the receiving system supports it. Smaller than JPEG and PNG at the same visible quality, handles transparency, and supports animation.
If you stop reading here, that is the answer 95% of the time. The rest of the article explains why, and when to deviate.
How JPEG compression works
JPEG is a lossy format. It throws data away to make the file smaller, and once that data is thrown out, it is gone. It does this in three main stages:
- Convert the image from RGB to YCbCr, which separates brightness from colour. The human eye is much more sensitive to brightness changes than to colour shifts.
- Downsample the colour channels (chroma subsampling), because the eye will not notice slight colour blur.
- Break the image into 8x8 blocks and apply a discrete cosine transform (DCT). High-frequency components, fine detail, get quantised more aggressively, which is what the quality slider controls.
The result: photographs compress beautifully because they are full of smooth gradients and low-frequency detail. But sharp edges in text, UI lines, or logos produce visible ringing because the DCT cannot represent a hard step cleanly.
How PNG compression works
PNG is a lossless format. It compresses by filtering each row (predicting pixels from their neighbours) and then running a general-purpose deflate algorithm, the same compression family ZIP uses, over the result. Nothing is ever discarded, so you can save and re-save a PNG forever without it degrading.
That makes PNG perfect for screenshots with pixel-perfect text and crisp UI lines, logos and icons with clean edges and few colours, and any image that needs an alpha transparency channel. But it is terrible for photographs. A 12-megapixel photo saved as PNG can easily be 15 to 25 MB; the same photo saved as JPEG quality 80 is around 1.5 to 2.5 MB and looks essentially identical.
PNG also has two modes: PNG-24 (full colour) and PNG-8 (up to 256 colours). PNG-8 is much smaller and is the right choice for logos with few colours.
How WebP compression works
WebP, developed by Google, supports both lossy and lossless modes. The lossy mode uses VP8 keyframe encoding, the same predictor logic that powers WebM video, and is consistently 25 to 35 percent smaller than JPEG at the same visible quality. Lossless WebP is typically 20 to 25 percent smaller than PNG. WebP also supports alpha transparency in both modes (JPEG cannot do this) and animation, replacing animated GIFs at far smaller sizes.
Browser support is universal today: Chrome, Edge, Firefox, Safari, and Samsung Internet all support WebP natively. The remaining problem is upload forms: some government and bank portals still only accept JPEG or PNG. When in doubt, ask or test.
Real-world size comparison
For a 1,200 by 800 photograph of a landscape, typical file sizes are roughly: PNG-24 around 2,000 KB, JPEG quality 80 around 180 KB, WebP quality 80 around 120 KB.
For the same dimensions of a flat-colour logo: PNG-24 around 30 KB, PNG-8 (16 colours) around 8 KB, JPEG quality 90 around 70 KB (and looks fuzzy at the edges), WebP lossless around 22 KB.
The logo example shows the key principle: matching format to image content matters more than picking the newest format.
When to use each format
Use JPEG when
- The image is a photograph.
- The receiving system requires JPEG (most government and ID forms).
- You do not need transparency.
Use PNG when
- The image is a screenshot or contains text or UI elements.
- The image needs transparency and the recipient does not accept WebP.
- You will re-edit and re-save the image multiple times.
- The image is a logo, diagram, or icon with sharp edges.
Use WebP when
- The image will be displayed on a modern website.
- You want a smaller file than JPEG or PNG at the same quality.
- You need transparency or animation in a smaller package than PNG or GIF.
A note on AVIF and HEIC
Two newer formats deserve a mention. AVIF is a still-image format derived from the AV1 video codec. It compresses even better than WebP and is increasingly supported in browsers. HEIC (also called HEIF) is what Apple devices use by default; it compresses very efficiently but is less widely supported on the web. For the foreseeable future, JPEG, PNG, and WebP cover almost every use case, but if you control both ends of the pipeline, AVIF can be a smart choice.
What about JPG versus JPEG?
They are the same format. The extension was shortened from .jpeg to .jpg historically because early Windows file systems limited extensions to three characters. Today both are recognised everywhere and you can use whichever you prefer.
Common mistakes
- Saving a screenshot as JPEG. The text gets fuzzy. Use PNG.
- Saving a photo as PNG to preserve quality. The file is 10 times larger for no visible benefit on screen. Use JPEG quality 80 to 85.
- Re-saving a JPEG repeatedly. Every save loses a little quality. Edit from a master copy or a lossless intermediate.
- Forgetting to resize. Format choice only matters after you have resized to display dimensions. See our guide on compressing an image to 100KB.
FAQ
Is WebP safe to use as my default image format?
Yes, on the web. Every modern browser supports it. The exception is some legacy upload portals that only accept JPEG or PNG; keep the original around so you can convert when needed.
Why does my JPEG have weird coloured blocks?
Those are quantisation artefacts. They appear when JPEG quality is set too low, or when an image with sharp edges has been forced through JPEG compression. Increase quality, or switch the image to PNG or WebP.
Does WebP work in email?
Most modern email clients show WebP images embedded in messages, but some older clients do not. For email-attached images, JPEG remains the safest choice.
What about transparent backgrounds in JPEG?
JPEG does not support transparency. If you save a transparent PNG as JPEG, the transparent areas typically turn white. Use PNG or WebP if you need transparency.
Will switching to WebP improve my site speed?
Almost always. WebP is consistently smaller than JPEG at similar quality, and image weight is the largest contributor to page weight for most sites.
Comments
Post a Comment