JPG vs PNG vs WEBP vs HEIC: which to use when
Four formats cover the vast majority of images people deal with. Each one is good at something and bad at something else, and choosing the right one cuts file size without sacrificing visible quality.
Published 2026-05-26 · All guides
Lossy vs lossless: the one distinction that matters most
Image compression splits into two families. Lossy codecs discard information the human visual system is unlikely to notice — subtle color shifts, high-frequency texture, fine gradations — in exchange for dramatically smaller files. Lossless codecs preserve every pixel exactly, in exchange for larger files. Both are useful; they're useful for different things.
JPEG is lossy. HEIC is lossy. WEBP can be either — the format supports both modes and the encoder picks. PNG is lossless. AVIF is usually lossy but supports lossless mode. The lossless formats are the safe choice when you can't afford to lose anything: line art, screenshots of text, UI mockups, anything you'll edit further. The lossy formats win for photos by enormous margins, often 10x smaller at quality differences nobody can spot at normal viewing distances.
JPEG: the old reliable
The Joint Photographic Experts Group standard was finalized in 1992 and remains the universally-supported lossy format. Every device, every browser, every operating system, every photo viewer made in the last thirty years reads JPEG. The encoding is based on the discrete cosine transform applied to 8×8 pixel blocks — the same math you'll see described in any image-processing textbook.
JPEG is excellent at photographs. It's terrible at flat-color graphics, text, and anything with sharp edges, because the block-based compression produces visible ringing around high-contrast transitions. It does not support transparency. It does not support animation. It supports embedded color profiles and EXIF metadata. Quality is set by a single integer (1 to 100); 80–90 is the sweet spot for web delivery, and the difference between 95 and 100 mostly doubles your file size for invisible gain.
A typical sRGB photograph saved as JPEG at quality 85 lands in the range of 0.1–0.3 bits per pixel. A 12-megapixel iPhone photo (4032×3024) saved as JPEG at quality 85 will be roughly 2–3 MB depending on subject complexity.
PNG: lossless and transparent
The Portable Network Graphics format was finalized in 1996 as a free replacement for GIF (whose LZW compression was under patent at the time). PNG uses DEFLATE compression — the same algorithm as ZIP — applied to the image after a per-row predictive filter. It is lossless, supports 8-bit alpha transparency, supports indexed color (PNG-8) and full truecolor (PNG-24), and is universally supported.
PNG is the right format for screenshots, UI mockups, logos, line art, charts, icons, and anything else with flat colors and sharp edges. It is the wrong format for photographs — a photo saved as PNG is typically 5–10x larger than the same photo as a high-quality JPEG, for no visible benefit.
That same 12-megapixel iPhone photo, re-saved as PNG, will weigh 20–30 MB. The same screenshot of a code editor saved as JPEG will be larger than the equivalent PNG and will have ugly compression artifacts around every glyph. Picking the right format here matters.
WEBP: the web-tuned compromise
Google released WEBP in 2010, originally as a wrapper around VP8 video frames for still images. Since then it's gained a lossless mode (using a different algorithm derived from WebP-lossless rather than VP8) and an animation mode that's roughly a GIF replacement.
In lossy mode, WEBP typically produces files about 25–35% smaller than JPEG at comparable visual quality, with the gain being larger for photos with smooth gradients and smaller for highly textured photos. In lossless mode, WEBP produces files about 20–25% smaller than PNG on average. WEBP supports transparency in both modes — this is the killer feature, because it means you can have small, lossy-compressed images with alpha channels, which JPEG simply cannot do.
Browser support is now universal: all current versions of Chrome, Firefox, Safari (since 14, released September 2020), and Edge handle WEBP natively. Native OS support is slower — Windows 10 didn't display WEBP in the Photos app until a 2018 update, and some older tools and editors still refuse the format. This is why "convert WEBP to JPG" remains a common need: not because WEBP is bad, but because some downstream tool insists on JPEG.
HEIC: smaller still, more friction
HEIC is the HEVC-encoded variant of the HEIF container, shipped by default on iPhones since iOS 11 (September 2017). At comparable visual quality, HEIC files are roughly half the size of JPEGs — a real, repeatable gain that explains why Apple defaulted to it.
The catch is licensing. HEVC patent royalties kept the format out of the Windows and Android ecosystems for years. As of 2026, Windows 11 supports HEIC if the user installs the (paid) HEVC Video Extensions from the Microsoft Store. Recent Android versions display HEIC. Most desktop image editors handle it. But you'll still occasionally hit a tool, a webform, or a website that refuses HEIC and demands JPEG, which is why the conversion remains a regular nuisance for iPhone owners sharing photos out of the Apple ecosystem.
HEIC supports transparency, multiple images per file (burst sequences, Live Photos), depth maps, and non-destructive edits stored as metadata. None of those features survive conversion to JPEG.
AVIF: the format that should win, eventually
AVIF (AV1 Image File Format) is HEIF wrapped around AV1, the royalty-free video codec backed by the Alliance for Open Media (Google, Mozilla, Netflix, Apple, Intel, and others). It hit Recommendation status as a media format in 2019 and got browser support across Chrome (85, August 2020), Firefox (93, October 2021), and Safari (16, September 2022). Edge supports it via the Chromium base.
AVIF compresses noticeably better than WEBP and HEIC. Lossy AVIF at similar visual quality typically produces files 20–30% smaller than WEBP, sometimes more for synthetic content. It supports transparency, animation, HDR, wide color gamut, and 10/12-bit color depth.
The reason AVIF isn't yet dominant is encoder speed. AV1 encoding is computationally expensive — orders of magnitude slower than JPEG encoding — though decode is fine. For web delivery where you encode once and decode millions of times, this is acceptable. For "save my photo right now" workflows, it's painful. As hardware AV1 encoders proliferate (some recent phone SoCs include them), this will improve.
Browser support as of 2026
The picture is much simpler than it was five years ago. JPEG and PNG work everywhere, in every browser, forever. WEBP works in every browser released after 2020. AVIF works in every browser released after late 2022. HEIC is the outlier — even in 2026, browser support for HEIC is largely absent except where the OS provides a system decoder. Safari on macOS and iOS handles HEIC natively. Chrome and Firefox generally do not. This is why an <img src="cat.heic"> tag fails on most desktops.
For web delivery, the practical answer for image-heavy sites is AVIF with a JPEG fallback via the <picture> element, with WEBP optionally in the middle. For images embedded in documents, emails, and one-off shares, JPEG remains the safest default.
Color profiles and metadata
All four formats support embedded ICC color profiles. JPEG, PNG, and WEBP also support EXIF metadata. HEIC supports EXIF natively. When you convert between formats, the color profile and metadata travel separately from the pixels, and not every converter preserves them. If you're shooting in Apple's Display P3 wide-gamut color space and converting to sRGB JPEG, a color-space conversion is happening — pixels that fell outside the sRGB gamut get clipped to its nearest equivalents. For Instagram, this is invisible. For print, it can matter.
GPS coordinates in EXIF metadata are a privacy concern most people don't think about. A photo taken with location services on can contain the latitude and longitude of where you stood when you took it, accurate to a few meters. Some converters strip this on output; some don't. Posting an "anonymous" photo with the GPS coordinates of your home in the metadata is a regular mistake.
What each format compresses well, in one paragraph each
JPEG is best at photographs with continuous tone — landscapes, portraits, skin tones, skies. It's bad at line art, text, and anything with sharp transitions. Around quality 85, the artifacts are usually invisible. Below quality 60, blocking becomes obvious.
PNG is best at flat colors, hard edges, transparency, and any image that will be edited further. It's bad at photos. A screenshot of a webpage is the canonical PNG use case.
WEBP lossy is JPEG with the bugs fixed — same photo, smaller file. Plus transparency. The compression gain is real but modest (25–35%); the bigger argument for WEBP is the transparency support.
HEIC is best at iPhone photos that will stay in the Apple ecosystem. The compression is excellent, but the friction outside Apple's walls remains significant.
A decision tree
Walking through what to pick, in order:
- Is it a photograph (real-world scene, captured with a camera)?
- Will it stay in the Apple ecosystem? → HEIC.
- Will it go to the web? → AVIF if you can, WEBP if you must, JPEG as fallback.
- Will it go to someone over email, in a Word document, on a printer? → JPEG.
- Is it a screenshot, UI mockup, logo, or anything with flat colors and sharp edges?
- Does it need transparency? → PNG, or WEBP lossless if size matters.
- No transparency? → PNG.
- Is it line art (a chart, an illustration, a diagram)?
- Vector source available? → SVG. (Outside the scope of this guide, but worth mentioning.)
- Raster only? → PNG.
- Is it a sequence of frames or an animation?
- For the web → WEBP animation, or just use a real video format (MP4, WEBM).
- For email → GIF, sadly, still the most compatible.
Converting between them
The mechanics of converting are simpler than the choice of which to convert to. The image converters on this site (HEIC→JPG, HEIC→PNG, JPG→PNG, JPG→WEBP, PNG→JPG, PNG→WEBP, WEBP→JPG, WEBP→PNG) all run in the browser. Files never leave your machine. The same conversions can be done locally with ImageMagick, Sips on macOS, or any image editor; the browser route is convenient and private.
One thing to remember: converting from a lossy format to anything else does not recover quality. JPEG → PNG gives you a lossless container around already-lossy pixels. The JPEG's compression artifacts are now baked in. If you want a clean copy, you need the original raw file.
Where to go from here
The right format depends on what you're doing with the image. For most personal use, JPEG remains the safest universal default. For anything with transparency, PNG. For web delivery where you control both encode and decode, WEBP or AVIF buys you real size savings. HEIC is the iPhone default and worth converting only when you need to leave the Apple ecosystem. When in doubt, JPEG at quality 85 is wrong only rarely — and small enough to email, print, or post without thinking about it.