GameParticles
Images

JPEG vs PNG: Which Image Format Should You Use and When?

JPEG vs PNG compared: JPEG gives small files for photos, PNG gives exact pixels and transparency for graphics. See file size, quality and when to use each.

Updated

Use JPEG for photographs and PNG for graphics. JPEG compresses photos into small files by discarding detail the eye rarely notices, but it has no transparency and it blurs sharp edges. PNG stores every pixel exactly and supports transparent backgrounds, which makes it the right choice for logos, screenshots, icons and anything with text, at the cost of much larger files for photos.

JPEG vs PNG at a glance

JPEGPNG
CompressionLossyLossless
TransparencyNoYes, full alpha channel
Colors16.7 million (24-bit)256-color palette up to 16.7 million, plus alpha
Best forPhotos, complex images with smooth tonesLogos, screenshots, text, line art, flat color
WeaknessArtifacts around sharp edges, loss on each re-saveLarge files for photographic content
Quality settingYes, 0 to 100No, always exact
Extensions.jpg, .jpeg.png
Standardized19921996

Both formats open in every browser, operating system and image editor, so compatibility never decides between them.

How JPEG works, and where it fails

JPEG splits an image into blocks of 8 by 8 pixels and describes each block as a combination of smooth patterns. It then stores the fine detail in those patterns less precisely, and usually stores color at a lower resolution than brightness. The quality setting controls how much is thrown away.

Photographs suit this well. They are full of gradual changes in tone, and the lost detail is hard to see. A JPEG at quality 80 to 85 is usually indistinguishable from the original at normal viewing size.

It fails on hard edges. Text, thin lines and flat color next to a sharp boundary pick up smudges and faint halos, often called ringing or mosquito noise. Red text on a dark background is a common worst case, because of the reduced color resolution. Large areas of one flat color can also show faint block patterns at low quality.

JPEG also degrades with each save. Opening a JPEG, editing it and saving it again runs the lossy step a second time. After several rounds the damage becomes visible. Keep an original and export from it.

How PNG works, and where it fails

PNG never changes a pixel. It predicts each pixel from its neighbors, stores the difference, and compresses the result with the same family of algorithm used in ZIP files. Open and save a PNG a hundred times and it is identical.

This works extremely well on images with repetition: flat backgrounds, interface elements, diagrams, pixel art. A screenshot of a text document can be smaller as a PNG than as a JPEG and look perfect.

It works poorly on photos. Camera noise and natural texture are close to random at the pixel level, and random data does not compress. A 12 megapixel photo holds about 36 MB of raw pixel data. As a JPEG it is typically a few megabytes. As a PNG it is commonly several times that, with nothing visible gained.

Transparency

This is often the deciding factor. PNG supports an alpha channel with 256 levels of opacity per pixel, so a logo can have soft, anti-aliased edges and sit cleanly on any background color. JPEG has no transparency of any kind.

If you convert a transparent PNG to JPEG, the transparent areas must become some color. Most tools use white. A logo placed on a dark page then shows up inside a white rectangle. If you need both small photographic files and transparency, neither format fits and WebP is the answer, covered in WebP vs PNG vs JPG.

File size in practice

Rough expectations for the same image saved both ways:

Image typeSmaller asWhy
Camera photoJPEG, by a wide marginNoise and texture defeat lossless compression
Screenshot of an app or documentPNG, usuallyFlat areas and sharp text compress losslessly and stay crisp
Logo with a few flat colorsPNGFew colors, hard edges, often needs transparency
Screenshot of a video or gameJPEGThe content is photographic even though it is a screenshot
Chart or diagramPNGThin lines and labels show JPEG artifacts
Scanned documentDependsPNG for clean black and white, JPEG for color scans

When a PNG is too large and has to stay a PNG, reducing its pixel dimensions is the dependable fix. Halving the width and height removes three quarters of the pixels.

JPG vs JPEG: the naming question

JPG and JPEG are the same format. The name comes from the Joint Photographic Experts Group, the committee that wrote the standard. Early Windows and DOS systems limited file extensions to three characters, so .jpeg was shortened to .jpg, and both have been in use ever since. The file contents are identical, and renaming photo.jpeg to photo.jpg changes nothing. The same goes for the less common .jpe and .jfif extensions.

Which one to use

  • Photo for a website, email or social post: JPEG.
  • Logo, icon or illustration with flat color: PNG, or SVG if you have the vector source. See SVG vs PNG.
  • Anything that needs a transparent background: PNG.
  • Screenshot with text: PNG.
  • An image you will edit again: PNG, or keep the original file, so no quality is lost between saves.
  • Product photo on a transparent background: PNG works but is heavy. WebP is a better fit.
  • Print: follow the printer's specification, which is often a high-quality JPEG, TIFF or PDF.

For most websites the real question today is whether to use either one. WebP and AVIF do both jobs in smaller files, and the wider field is compared in image file formats.

Converting between them

Converting PNG to JPEG makes sense when someone saved a photo as PNG. Converting JPEG to PNG never improves quality. The detail JPEG discarded is gone, and the PNG faithfully stores the artifacts in a larger file. The only reasons to do it are to stop further loss during editing or to satisfy an upload form.

The Image Compressor converts in both directions. Drop in a PNG, choose JPEG as the output format, and adjust the quality slider while comparing the before and after preview. Transparent areas are filled with white in JPEG output. Choose PNG output instead to re-pack a PNG losslessly. It handles batches and downloads them as a ZIP.

To move either format to something smaller for the web, the WebP Converter takes PNG and JPG files, converts them to WebP with a quality slider, and shows the size saving for each file. Transparency carries over. If an image is simply too many pixels, set exact dimensions in the Image Resizer, which exports PNG, JPEG or WebP.

For choosing a quality number and a sensible order of steps, see how to compress images without losing quality.

Try it

Drop a photo that was saved as PNG into the Image Compressor, switch the output to JPEG at quality 80, and compare the file sizes. Then try the same with a screenshot of text and look at the edges of the letters to see why PNG exists.

Tools in this guide

Frequently asked questions

Is PNG or JPG better quality?

PNG is lossless, so it stores every pixel exactly, while JPG discards some detail to save space. For photos the difference is rarely visible at high JPG quality. For text, logos and screenshots, PNG is visibly cleaner.

What is the difference between JPG and JPEG?

There is none. JPG and JPEG are the same format with the same contents. The shorter extension exists because early versions of Windows limited file extensions to three letters. Renaming a file from one to the other changes nothing.

Does JPEG support transparency?

No. JPEG has no alpha channel, so every pixel is fully opaque. Converting a transparent PNG to JPEG fills the transparent areas with a solid color, usually white. Use PNG or WebP when you need a see-through background.

Why is my PNG file so much bigger than the JPG?

PNG compression is lossless and cannot discard detail, and photos contain noise and fine texture that do not compress well that way. The same photograph saved as PNG is commonly several times larger than a high-quality JPG.

More images guides

JSON Formatter
Developer · Format, validate and minify JSON with syntax highlighting.
↵
Base64 Encode / Decode
Developer · Encode text to Base64 or decode Base64 back to plain text.
↵
URL Encoder / Decoder
Developer · Encode or decode URL components and query strings.
↵
Hash Generator
Developer · Generate MD5, SHA-1, SHA-256 and SHA-512 hashes.
↵
UUID Generator
Developer · Generate UUIDs v4 (random) in bulk with one click.
↵
Regex Tester
Developer · Test regular expressions against text with live match highlighting.
↵
Word Counter
Text · Count words, characters, sentences, paragraphs and reading time.
↵
Case Converter
Text · Convert text between UPPER, lower, Title, camelCase, snake_case and more.
↵
List Sorter
Text · Sort, reverse, deduplicate and shuffle lists of text.
↵
Markdown Preview
Text · Write Markdown and see a live rendered preview side by side.
↵
Percentage Calculator
Numbers · Calculate percentages, increases, decreases and what % one number is of another.
↵
Color Converter
Colors · Convert colors between HEX, RGB, HSL and HSV instantly.
↵
Snake
Arcade · Eat food, grow longer, don't hit the walls. A timeless classic.
↵
2048
Puzzle · Slide tiles and combine them to reach the legendary 2048 tile.
↵
Word Grid
Puzzle · Guess the hidden five letter word in six tries using color clues.
↵
Sudoku
Puzzle · Fill the 9x9 grid with logic. Four difficulties from easy to expert.
↵
Minesweeper
Strategy · Use number clues to clear the minefield. Classic logic, three levels.
↵
Breakout
Arcade · Smash every brick with paddle and ball. Power-ups, combos, endless levels.
↵
Typing Practice
Casual · Build your WPM and accuracy with timed drills from 30 seconds to 5 minutes. Find your weak keys.
↵
TypeRunner
Arcade · Multiplayer typing race. Race friends by link, beat computer runners, or chase your own ghost.
↵
Typing Blocks
Arcade · Type each word before its wooden block lands. Miss, and the pile climbs toward the line.
↵
Bubble Shooter
Arcade · Aim, bank shots off the walls, and pop groups of three or more bubbles.
↵
Road Rush
Arcade · Race seven rivals through traffic and punch your way to the front.
↵