PNG vs JPG: which should you use, and when is each one smaller?

· Heart Photos

A purple aperture-shaped logo centered on a black background
A purple aperture-shaped logo centered on a black background · Made by AI

Use JPG for photographs and anything that looks like one, and PNG for screenshots, text, charts, logos with flat colors, and anything that needs a transparent background. A JPG throws away detail you are unlikely to notice and is usually several times smaller; a PNG keeps every pixel exactly. On 52 photo-like images from the Heart Photos wall, a quality 85 JPG was 12.7% of the size of a carefully saved PNG at the median. On a simple chart with text, the PNG was the smaller file and the JPG smudged the edges.

What is the difference between PNG and JPG?

They compress in opposite ways.

  • JPG (or JPEG) is lossy. MDN describes it as "based on the discrete cosine transform" and "particularly useful for photographs," and warns that "applying lossy compression to content requiring sharpness, like diagrams or charts, can produce unsatisfactory results." The format dates from 1992, as ISO/IEC 10918.
  • PNG is lossless. The W3C's PNG specification calls it a format for "the lossless, portable, well-compressed storage" of images, and MDN says it is "preferred over JPEG for more precise reproduction of source images, or when transparency is needed."

JPG and JPEG are the same format; .jpg and .jpeg are two spellings of the same file extension.

JPG PNG
Compression Lossy Lossless
Transparency No: "JPEG does not support an alpha channel" (MDN) Yes, full alpha
Bits per channel 8 Up to 16 (PNG specification)
Saving again Loses a little each time it is re-encoded Never changes the pixels
Best at Photos, renders, anything with smooth gradients and fine noise Screenshots, text, charts, line art, flat logos

The current PNG standard is newer than many people think: the third edition became a W3C Recommendation on Jun 24, 2025, adding animated PNG, HDR (HLG and PQ) and an Exif chunk to the official specification.

Which is smaller, PNG or JPG?

For photographs, JPG by a wide margin. We measured it on Nov 23, 2026, with the 52 PNG originals in the wall's Made by AI tag that are not images of people: landscapes, interiors, castles, ships, logos and game-like scenes, 1.5 megapixels by median. For each one we made:

  • a PNG saved again by Pillow with optimize=True, so PNG is not losing because it was saved carelessly,
  • a JPG at quality 85 with 4:2:0 chroma subsampling, the usual web setting,
  • a JPG at quality 95 with no chroma subsampling (4:4:4), a "keep it nearly perfect" setting.

The JPGs came from libjpeg-turbo 3.1.3 inside Pillow 12.1.1, with optimized Huffman tables. We then decoded each JPG and compared it with the original pixels using PSNR, a rough measure of closeness where higher is closer (above about 40 dB the difference is usually hard to see on a photo).

Median size vs the PNG Range across the 52 All 52 together Median PSNR
PNG, optimized 100% 100% 112.5 MB Exact
JPG, quality 95, 4:4:4 28.3% 15.5% to 54.9% 33.6 MB 43.5 dB
JPG, quality 85, 4:2:0 12.7% 3.7% to 22.6% 16.0 MB 38.0 dB

The JPG was smaller on all 52 images, at both settings. Even the near-perfect quality 95 JPG was a little over a quarter of the PNG.

The image at the top of this post is a good surprise. It looks like a flat logo, but it was made by an AI model, so its edges are soft and its black is full of faint noise. As a PNG it is 571 KB; as a quality 85 JPG it is 28.6 KB, 5% of the size. If an "illustration" came out of a camera, a 3D renderer or an image model, it usually behaves like a photo.

When is PNG better than JPG?

When the image has flat areas of one color and hard edges: screenshots, text, charts, diagrams, pixel art, and logos drawn in a vector program. To show it, we drew a 1600 by 900 bar chart with a title and labels on a white background in Pillow, and saved it both ways:

The chart saved as Size Largest error on one pixel
PNG, optimized 20.8 KB None
JPG, quality 85, 4:2:0 35.4 KB 90 of 255
JPG, quality 95, 4:4:4 57.4 KB 21 of 255

The PNG was smaller than both JPGs, and exact. The JPG at quality 85 was 70% bigger and still changed some pixels near the letters and bar edges by 90 steps out of 255: that is the faint halo or "mosquito noise" you see around text in a screenshot saved as JPG. PNG wins here because long runs of identical pixels compress very well losslessly, while JPG spends its bytes trying to describe sharp edges with smooth waves.

Pick PNG as well when you need:

  • Transparency, such as a logo over a colored page or a product cut out from its background. A JPG fills transparent areas with a solid color.
  • An exact master copy you will edit and save again. Each JPG save can lose a little more; see does saving a JPEG multiple times reduce quality? for how much.
  • 16 bits per channel, from scanners, HDR work or heavy color grading. JPG has 8.

Which should you use on a website?

For a web page, the honest answer is often "neither, as served". web.dev's guide to choosing a format says of a photo or screenshot: "Use JPEG, lossy WebP, or AVIF." Those newer formats are smaller than JPG at the same look, and lossless WebP is smaller than PNG with the same pixels: our PNG vs WebP test found 28% saved by median. Keep JPG and PNG as the files you edit and share, and let your site or image service serve the modern format.

You have Save or share as Serve on a web page as
A photo JPG, quality around 85 to 90 AVIF or WebP, JPG as the fallback
A screenshot or chart PNG Lossless WebP, or PNG
A logo with transparency PNG (or SVG if you have the vector) SVG, or lossless WebP
An AI-made or rendered image JPG, unless it has text or transparency AVIF or WebP

For the full comparison of the newer formats, read AVIF vs JPEG XL vs WebP, and for which JPG quality to pick, what JPEG quality should I use?

Frequently asked questions

Is PNG higher quality than JPG?

A PNG is exact, so it can never look worse than its source. A JPG at quality 85 to 95 usually looks the same as the original on a photo, at a fraction of the size. On text and sharp lines, the difference is easier to see, and PNG is the better choice.

Does converting a JPG to PNG improve quality?

No. The PNG keeps exactly the pixels the JPG already had, including any blockiness, and the file usually becomes several times bigger. Convert to PNG only if you need to edit and save it again many times, or a tool requires PNG.

Why is my PNG so big?

Most likely it is a photo, or a photo-like image, saved as PNG. Lossless compression cannot drop the fine noise in a photo, so the file stays large. In our test the same images as quality 85 JPGs were about one eighth of the size.

Can a JPG have a transparent background?

No. JPG has no alpha channel. Use PNG, or WebP or AVIF, which support transparency in both lossless and lossy modes. If you are cutting out a subject, see how to remove the background from an image.

Is JPG the same as JPEG?

Yes. It is one format with two spellings of its file extension, .jpg and .jpeg. Renaming one to the other changes nothing inside the file.

What Heart Photos does

You can upload either, and Heart Photos keeps what you gave it. A JPG original is stored as JPEG XL, and Download Original hands you back the very JPG you uploaded, byte for byte. A PNG is stored as a lossless JPEG XL or lossless WebP, whichever is smaller, and only after decoding it and finding exactly the same pixels; Download Original gives you a PNG of those pixels. Visitors to your images get AVIF in the sizes each screen needs, so you do not have to choose a web format at all.

To try it with your own photos and screenshots, Open Heart Photos and upload them. To keep the location out of a photo before you share it, read how to remove location data from a photo.

More from the blog