Skip to content

Image File Formats Explained: JPEG vs PNG vs TIFF vs WebP vs HEIF

Bright red and orange maple leaves on thin branches against a deep blue background with a few white clouds
Photo: Bright Autumn Leaves with Sky Reflection by Duncan Rawlinson. 118mm, f/11, 1/2, ISO 50. Saturated red leaves with fine serrated edges against deep blue are the hardest test for a lossy format, because color detail is stored more coarsely than brightness; at ISO 50 the blue is clean, so there is no grain to hide any color bleeding along those edges.

An image file format is the set of rules a file uses to store a photograph: how the pixels are packed, how much detail is thrown away to make the file smaller, how many shades each color can have, and what extra information rides along. The format you pick when you save or export decides how good the picture can look, how big the file is, who can open it, and how much editing it can take later.

The short answer for most photographers: capture in raw, edit from raw or a 16-bit TIFF, send JPEG to people and to most print labs, use WebP or AVIF on your own website, and keep PNG for screenshots, graphics and anything that needs a transparent background. Phones often save HEIC, which is fine to keep. The rest of this page explains why, so you can decide for yourself when a case does not fit.

Four questions that separate one format from another

For photographs, formats differ on four things. Ask these of any format and you know what it is for.

  1. Does it throw data away? Lossless compression shrinks the file and gives back every pixel exactly when you open it, the way a ZIP archive returns a document unchanged. Lossy compression shrinks it much further by discarding detail you are unlikely to notice, and that detail never comes back.
  2. How many shades per channel? This is bit depth. An 8-bit file has 256 levels of red, green and blue; a 16-bit file has 65,536. More levels mean more room to edit before smooth tones break into steps.
  3. Which colors can it describe? A file carries a color space, such as sRGB or a wider one, usually as an embedded ICC profile. JPEG, PNG, TIFF, WebP, AVIF and HEIF can all embed a profile. A file without one leaves the viewer to guess.
  4. What else can it hold? Transparency, layers, several images in one file, and metadata: camera settings (EXIF), captions, copyright and keywords.

One more idea clears up a lot of confusion: a container is not the same as a codec. The container is the wrapper and its file extension; the codec is the method that compresses the pixels inside. HEIF is a container. HEIC is HEIF holding pictures compressed with the HEVC video codec, and AVIF is the same family of container holding pictures compressed with the AV1 codec. It is also why renaming .heic to .jpg converts nothing: the bytes inside are unchanged.

How lossy compression decides what to throw away

JPEG is the model for nearly every lossy photo format, and it removes detail in a fixed order. That order tells you where to look for damage.

Step 1: color detail goes first

Your eye is far more sensitive to fine changes in brightness than to fine changes in color. So the encoder splits each pixel into a brightness value and two color values, keeps brightness at full resolution, and often stores color at half the width and half the height. This is called chroma subsampling, written 4:2:0. One color sample now covers a block of four pixels, so the data drops from three values per pixel to one and a half, a 50% cut before any other step. You see it only on small, strongly colored detail: a red edge against blue, fine red text, or saturated flowers, which go slightly soft or bleed. Many programs use 4:2:0 at everyday quality settings and keep full color detail (4:4:4) only at the top settings, and some let you choose. Lossy WebP always uses 4:2:0.

Step 2: the picture is cut into 8 by 8 blocks

Each block of 64 pixels is rewritten as a mix of 64 standard patterns, from a flat tone to a fine checkerboard. A 6000 by 4000 pixel photo holds 375,000 of these blocks in its brightness channel alone. Nothing is lost yet.

Step 3: quantization, the step that actually discards

The encoder now rounds off the strength of each pattern, rounding the finest patterns most coarsely because they are the hardest to see. The quality setting controls how hard it rounds. Apart from step 1, this is the only step that removes detail. Rounding is also why a JPEG saved at quality 100 is still lossy: the rounding is gentle, but it is not zero.

A tall roadside sign with red and white letter blocks spelling DUDE above a yellow MOTEL panel, in front of a low glass-fronted motel under a pale flat sky
Photo: Dude Motel by Duncan Rawlinson. 55mm, f/5, 1/200, ISO 100. Hard-edged red and yellow lettering against a flat pale sky, shot sharp at f/5, 1/200 and ISO 100, is where a heavily compressed JPEG shows faint halos along the letter edges and slightly blurred red, the two signs of block rounding and reduced color resolution.

Where the damage shows first

  • Hard edges against flat areas, such as lettering on a sign or a roofline against sky, pick up faint halos and speckles called ringing, because rounding the fine patterns cannot quite rebuild a sharp step.
  • Smooth gradients, such as clear sky or fog, show the 8 by 8 grid as faint blocks and bands at low quality.
  • Fine texture, such as grass, leaves and hair, hides mild compression well, then turns to smudge when quality is pushed very low.

These marks are compression artifacts.

What really wears a JPEG down

A common belief is that a JPEG loses quality every time you open it, or that saving it ten times in a row ruins it. Neither is quite right.

  • Opening, viewing and copying cost nothing. The file is only read, or its bytes copied as they are.
  • Resaving with no change, at the same settings, costs little after the first save. The first resave rounds the values again and loses a small amount. After that, the values are already rounded to the same steps, so further identical saves change very little and soon settle.
  • Edits between saves keep adding loss. Brightness or color changes, sharpening, a crop that shifts the 8 by 8 grid, resizing, rotating (unless the app says it rotates losslessly), or a different quality setting each time all force the encoder to round fresh values. Ten rounds of edit and save can look clearly worse than the original.

The practical rule is the same as it always was, for a better reason: keep your editing in raw or a lossless format, and make a JPEG once, as the last step, from that file.

Bit depth: why an edited sky breaks into stripes

Bit depth is the number of steps between black and full brightness in each channel. Each extra bit doubles them.

Bits per channel Levels per channel Possible RGB colors Where you meet it
8 256 16.8 million JPEG, most PNG, WebP, most screens
10 1,024 1.07 billion Some HEIF and AVIF files, HDR video
12 4,096 68.7 billion Many raw files
14 16,384 4.4 trillion Many raw files
16 65,536 281 trillion 16-bit TIFF and PNG working files

The color counts are the levels per channel cubed (256 × 256 × 256 = 16,777,216, for example). Raw files record one value per pixel rather than three, so for raw only the levels column applies.

Here is why it matters. Suppose a clear sky changes by 40 levels of blue from the top of a 4000 pixel tall frame to the horizon. In an 8-bit file that is only 40 distinct shades, so each shade fills a band about 100 pixels tall. That usually still looks smooth. Now brighten and add contrast to that sky in editing, and the 40 shades are stretched apart; the gaps between them become visible stripes called banding. A 16-bit file holds 256 levels for every one 8-bit level, so the same stretch of sky has 40 × 256 = 10,240 shades, more than two per pixel row, and survives the same edit with no visible steps.

A cloudless evening sky fading from deep blue overhead to pale yellow at the horizon, above a bay with mountains on the left and a row of city towers on the right
Photo: Gradient Sky by Duncan Rawlinson. 18mm, f/5.6, 1/125, ISO 100. A clear sky that fades from deep blue to pale yellow over most of the frame, shot clean at ISO 100, is exactly the smooth, grainless gradient that breaks into bands if an 8-bit file is pushed hard in editing.

The finished picture rarely needs more than 8 bits. Most screens and print paths show 8 bits per channel or close to it, and a well-edited 8-bit JPEG of this scene looks smooth. The extra bits are headroom for editing, not something you see in the final file: high bit depth while you work, 8-bit for delivery. A little noise or grain also hides banding, so noise-free skies band more easily than grainy ones.

Already seeing stripes in a sky you edited? Bit depth shows what banding looks like, how to tell it from other stripes, and how to keep it out of your edits.

The formats, one by one

Format Compression Bits per channel Transparency Who can open it Best use
JPEG Lossy 8 No Everything Sharing, client delivery, most prints
PNG Lossless 8 or 16 Yes Everything Screenshots, graphics, text, transparency
TIFF None or lossless (JPEG inside TIFF is possible but best avoided) 8, 16 or 32 Yes Editors and labs; few browsers Working files, print, archive
WebP Lossy or lossless 8 Yes Browsers; patchy in editors Web pages
AVIF Lossy or lossless 8, 10 or 12 Yes Current browsers; patchy in editors Web pages, HDR images
HEIF / HEIC Usually lossy 8 or 10 as phones and cameras write it Yes Phones and current computers; few browsers Space-saving capture
Raw Uncompressed, lossless or lossy, by camera setting Usually 12 or 14 Not applicable Raw editors only Capture
DNG As raw, lossless or lossy As the camera recorded Not applicable Most raw editors Raw in an openly documented form

JPEG: the one everyone can open

JPEG is lossy, 8-bit, and readable by every device, browser and app made in the last few decades. JPG and JPEG are the same format; the three letter extension dates from old systems that limited extensions to three characters. It is small and looks right everywhere, but it is a finished product: 8 bits and lossy rounding leave little room for more editing.

Quality numbers are not universal. A setting of 80 in one program is not the same rounding as 80 in another, and one widely used editor uses a 0 to 12 scale instead of 0 to 100. As a starting point, most programs show no visible difference from the original somewhere between 80 and 90, and artifacts start to show in skies and edges below about 60. The jump from 90 to 100 makes the file much larger, often about double, for a gain you will rarely see.

The edge of a mixed forest in autumn, white birch trunks and dark pines among bright red maple leaves over a floor of yellow and brown undergrowth
Photo: Edge of Forest Fall Color by Duncan Rawlinson. 70mm, f/5.6, 1/500, ISO 400. Thousands of small leaves, twigs and grasses at 70mm and f/5.6 make the busy fine detail that hides moderate JPEG compression well, so a quality around 80 looks the same as 100 here, yet it is the first thing to turn to smudge when quality is set very low.

PNG: lossless, built for graphics

PNG is lossless and supports full transparency. It shines on screenshots, diagrams, logos and anything with flat color and crisp text, where it is often smaller than a JPEG and perfectly sharp. On photographs it is the wrong tool. A photo has almost no repeated areas for lossless compression to squeeze, so a PNG of a photo is typically three to six times the size of a high-quality JPEG, with no difference you can see. Use it for a photo only when you need a transparent background, such as a cut-out product shot.

TIFF: the lossless working and print file

TIFF stores 8, 16 or 32 bits per channel, any color space, layers and transparency, either uncompressed or with lossless compression (it can also hold JPEG compression, which is lossy and defeats the point). That makes it the standard way to hand a still-editable file to another program, a retoucher or a print lab. It offers two lossless compression methods: LZW and ZIP. On 8-bit files both work. On 16-bit files LZW often saves little and can even make the file larger, so choose ZIP for 16-bit TIFFs. Both are lossless; neither changes a pixel.

WebP and AVIF: for web pages

WebP and AVIF were designed to make web pages load faster. At the same visible quality, lossy WebP files are often about a quarter to a third smaller than JPEG, and AVIF files are often smaller again. Both support transparency. WebP is limited to 8 bits, and its lossy mode always reduces color resolution, which can soften fine saturated reds and blues. AVIF goes to 10 or 12 bits and can hold HDR images. Support in browsers is now broad, but many editing apps and older systems open them poorly, so treat both as export formats for a website, not as files to edit or keep as originals.

Putting your photos on your own site? How to build a photography portfolio website covers the rest of the job.

HEIF and HEIC: what your phone saves

HEIF and HEIC files often match a JPEG’s visible quality at roughly half the file size, and many phones save them by default. Phones and cameras usually write 8 or 10 bits and can record wide color and HDR. HEIC is not a lower quality phone format; at the same size it usually looks better than JPEG. The catch is compatibility: some computers need an extra codec, some editors cannot read it, and few browsers display it.

Raw and DNG: a category, not a single format

A raw file holds the sensor’s readings before the camera has applied white balance, color, a tone curve or sharpening. Each camera maker has its own raw format and extension, so raw is a family of formats rather than one. It records one value per pixel at 12 or 14 bits, which is where its editing latitude comes from: highlights and shadows that look lost in a JPEG can often be brought back, because the full dynamic range the sensor caught is still in the file.

Two corrections to common beliefs. First, raw is not always lossless. Many cameras offer a compressed raw option, and on some it is lossy; the loss is small, but it is not zero. Second, raw is not always proprietary. DNG is an openly documented raw format that some cameras and phones write directly, and most raw editors can convert other raw files to DNG. DNG itself can also be saved in a lossy form to save space, so check which kind you are making.

Deciding whether to shoot raw at all? Raw vs JPEG sets out what each costs and gives you.

JPEG XL and GIF, briefly

JPEG XL is a newer format that handles high bit depth and both lossy and lossless compression, and it can repack an existing JPEG losslessly into a file about a fifth smaller, then give back the original JPEG byte for byte. Support is still patchy, so check before you rely on it. GIF, at the other end, can show only 256 colors in a frame, which posterizes photographs. It survives for short animations; use another format for still photos.

What a 24 megapixel photo weighs in each format

The uncompressed figures are arithmetic for a 6000 by 4000 pixel image; the compressed ones depend on the picture and are typical, not fixed.

  • Uncompressed 16-bit RGB (TIFF): Size: 144 MB. How it is reached: 24 million pixels × 3 channels × 2 bytes.
  • Uncompressed 8-bit RGB (TIFF): Size: 72 MB. How it is reached: 24 million pixels × 3 channels × 1 byte.
  • Uncompressed 14-bit raw: Size: 42 MB. How it is reached: 24 million pixels × 1 value × 14 bits.
  • 8-bit color after 4:2:0 subsampling, before anything else: Size: 36 MB. How it is reached: 24 million pixels × 1.5 values.
  • Lossless 8-bit PNG or ZIP TIFF: Size: Typically 35 to 50 MB. How it is reached: Lossless methods squeeze photos only modestly.
  • High-quality JPEG: Size: Typically 5 to 15 MB. How it is reached: Busy detail at the top of the range, plain skies at the bottom.

A 10 MB JPEG from a 72 MB image is a reduction of about seven to one, which is why JPEG took over: most of that saving comes from discarding detail you would struggle to see.

Which format at each stage of your workflow

Each stage of a picture’s life has a different job, so each has a different best format. This is the backbone of any photography workflow.

  • Capture: Format: Raw (or HEIC/JPEG when space or speed matters more than editing). Why: Most data, most editing room.
  • Edit: Format: Raw with saved edits, or a 16-bit TIFF or your editor’s own layered file. Why: Lossless, high bit depth, edits stay changeable.
  • Share on social media, email, messages: Format: JPEG, sRGB. Why: Opens everywhere; platforms recompress anyway.
  • Your own website: Format: WebP or AVIF, with JPEG as the fallback. Why: Smaller files, faster pages.
  • Print lab: Format: JPEG at top quality, or TIFF when the lab asks. Why: Labs vary; ask first.
  • Client delivery: Format: JPEG, sRGB, high quality. Why: Opens on every device the client owns.
  • Graphics, screenshots, transparency: Format: PNG (or WebP for the web). Why: Crisp edges, alpha channel.
  • Archive: Format: Original raw files (or DNG copies), plus 16-bit ZIP TIFF for finished work. Why: Lossless and readable for decades.

Export settings for each destination

The format is half the decision; the settings you export with are the other half.

Web and social media

  • JPEG in sRGB, or WebP or AVIF for your own site.
  • Quality around 80 to 85 in most programs.
  • Long edge sized to how the image will be shown, often around 2000 to 2500 pixels. Check the current sizes in social media photo sizes.
  • Output sharpening for screen.
  • Know that most social platforms resize and recompress what you upload, and many strip the camera data. Exporting at 100 is wasted there; export close to the size they display, so their resize does less damage.

Print

  • JPEG at the highest quality, or 16-bit TIFF if the lab accepts it.
  • sRGB unless the lab says it accepts a wider space; for your own wide gamut printer, a wide space with the paper profile applied at print time.
  • Enough pixels: at 300 PPI a 6000 by 4000 pixel file prints 20 by 13.3 inches without upsampling, and at 240 PPI it prints 25 by 16.7 inches.
  • Output sharpening for the print size and paper.

JPEG or TIFF for prints? For most prints, a top-quality JPEG made once from your raw or TIFF prints with no difference you can see from a TIFF, and many consumer labs accept nothing else. Send TIFF when the lab asks for it, when the picture has large smooth gradients you want to protect with 16-bit data, when someone will retouch it before printing, or when you print on your own wide gamut printer from a 16-bit file. Soft proofing with the lab’s paper profile shows you the result before you pay, and preparing photos for print covers the full process.

Not sure your file has enough pixels for the size you want? The print size calculator checks it.

Archive

  • Keep the original raw files, or lossless DNG copies of them.
  • For finished work, a 16-bit TIFF with ZIP compression.
  • Full resolution, ICC profile embedded, metadata such as captions, keywords and copyright included.

A format keeps nothing safe on its own. How to back up photos covers the copies that do.

Converting between formats

Two rules decide whether a conversion is worth doing. Converting from one lossy format to another (WebP to HEIF, HEIC to JPEG, WebP to JPEG) decodes the picture and compresses it again, so it always loses a little and never gains. Converting to a lossless format (JPEG to TIFF or PNG) stops any further loss, but it cannot restore what was already discarded.

  • HEIC to JPEG: the usual fix when someone cannot open a phone photo. Export at high quality. If you plan to edit and save several times, convert to TIFF instead.
  • WebP to HEIF: possible in any app that writes HEIF, but rarely worth it, since both are lossy and HEIF opens in fewer places. If you need a HEIF, make it from your raw file or TIFF instead.

Common mistakes with image file formats

  • Editing a JPEG and saving over it again and again. Each edit and save rounds the picture again. Keep the original, work in raw or a lossless copy, and export a JPEG once at the end.
  • Converting a JPEG to TIFF or PNG to “improve” it. The file gets bigger; the picture stays exactly as it was.
  • Renaming the extension to convert a file. Changing .heic to .jpg changes only the name. Export or convert it in an app instead.
  • Saving photos as PNG for quality. Same picture, several times the file size. Use PNG for graphics and transparency.
  • Doing heavy sky edits in 8 bits. Strong curves on an 8-bit file are the usual cause of banding. Edit from raw or in 16-bit, then export to 8-bit.
  • Exporting without a profile, or in a wide color space for the web. Colors shift or look dull in browsers and at labs that expect sRGB. Embed the profile and use sRGB unless you know the destination wants something else. Color spaces covers which space to pick.
  • Using LZW on 16-bit TIFFs. It can make the file bigger. Use ZIP.

Try this: find your own JPEG quality setting in 10 minutes

Use any editor that exports JPEG with a quality slider.

  1. Pick one photo with a smooth sky or other gradient and some fine detail, ideally a raw file or the camera’s original.
  2. Export it as JPEG at 100, 90, 80, 60, 40 and 20, naming each file with its number. Keep the size and every other setting the same.
  3. Write down each file size. Notice how much bigger 100 is than 90.
  4. Open each one at 100% zoom. Look in three places: the smoothest part of the gradient, the edge of a dark shape against a light area, and a patch of fine texture.
  5. Now test the resave myth. Open the 80 file, save it again at 80 under a new name with no edits, and repeat three times. Then do the same three times with a small brightness change each round.

How to judge it: the lowest number where you cannot tell the file apart from the 100 version at normal viewing size is your everyday setting in that program. At 40 and 20 you should see blocks in the gradient and halos along the edges first; the texture will hide the damage longer. In the resave test, the unchanged copies should look nearly identical to the first 80 file, while the edited copies drift further each round.

Want to check you know what compression, bit depth and raw each change in a file? Try the RAW vs JPEG quiz.

Frequently asked questions about image file formats

Are JPG and JPEG different formats?

No. They are the same format with two spellings of the extension. The three letter .jpg dates from older systems that allowed only three characters after the dot.

Which format has the best quality?

For a finished photo, a lossless file and a high-quality JPEG usually look identical; the difference is how much editing each can take. Raw holds the most information, a 16-bit TIFF is the best edited file to keep, and a well-made JPEG is as good as any viewer will see.

Is HEIC worse than JPEG?

Usually not. At the same file size, HEIC typically looks as good as or better than JPEG and can hold 10 bits and wider color. Its weakness is compatibility, not quality, so keep the HEIC originals and make JPEG copies for people who cannot open them.

Does the 72 or 300 PPI setting in a file change its quality?

No. It is a note in the file that says how large to print it; the pixels are the same either way, and screens ignore it. It matters only when printing, where 6000 pixels at 300 PPI comes out 20 inches wide. DPI vs PPI explains the number in full.

Should I convert my raw files to DNG?

It is a sound choice for long-term storage, because DNG is openly documented and widely read. Many photographers keep their camera’s own raw files instead, which is also fine as long as current software still opens them. Whichever you choose, check whether the conversion is lossless or lossy, and keep backups.