Skip to content
universalImage Converter

Blog

JPEG vs PNG: Choosing by What Is in the Picture

Photographs belong in JPEG; text, hard edges and transparency belong in PNG. The reason is mechanical, and a few edge cases bend the rule.

By the Universal Image Converter Team

What each format is good at, in one comparison

JPEG throws away fine detail that eyes rarely miss, which makes photographs small. PNG keeps every pixel exactly, which keeps text and sharp lines clean and allows partial transparency. Neither is better in general; each fails on the other's home ground. The table shows how far apart they land. The pictures are synthetic: Picture A is a 1920 x 1080 screenshot-like image of flat color blocks and text, Picture B is a 1920 x 1080 image of smooth gradients and blurred shapes with fine noise, standing in for a photo. Encoded with Pillow; your real files will differ in the numbers but usually not in the direction.

PictureFormatBytesCompared with PNG
A (flat, text)PNG135,263baseline
A (flat, text)JPEG quality 90219,7831.6 times larger
A (flat, text)JPEG quality 80173,3081.3 times larger
B (gradients, noise)PNG3,587,826baseline
B (gradients, noise)JPEG quality 90330,904about 11 times smaller
B (gradients, noise)JPEG quality 80172,596about 21 times smaller

Why the results flip

PNG predicts each pixel from its neighbors and stores only the leftover difference, then compresses that. Where neighbors match, as in a flat blue rectangle, the leftovers are zeros and cost almost nothing. Where every pixel carries random variation, as in sensor noise or film grain, the leftovers are unpredictable and cannot be squeezed. That is why Picture B costs 3.6 MB as PNG against 6.2 MB uncompressed.

JPEG works the other way. It transforms small blocks into patterns of broad and fine variation and rounds the fine part toward zero, so noise it deems invisible is simply not stored. On a flat image with sharp edges there is little to discard, but the transform spreads each edge across many coefficients, so edges need many numbers or turn fuzzy. The step-by-step version is in lossy vs lossless.

Decision rules you can apply in ten seconds

What JPEG does to small text

The textbook warning is that JPEG smudges text. I measured it on a 600 x 120 white image holding one line of black 22-pixel text. As a PNG it was 4,753 bytes. As a JPEG at quality 95 it was 7,737 bytes, larger than the PNG, and at quality 75 it was 5,001 bytes, still larger. At quality 75 the worst pixel near a letter edge was off by 37 levels out of 255, which shows up as faint gray speckle around the strokes. At quality 20 the file dropped to 3,204 bytes and the worst error reached 112 levels, visibly dirty.

So for text, JPEG often loses twice: no size benefit and worse edges. The exception is a large photo that happens to contain a caption, where the picture dominates the byte count and a slightly rough caption is the price.

A worked example: scaling the numbers to a phone photo

A 12-megapixel phone photo (4000 x 3000) holds 4000 x 3000 x 3 = 36,000,000 bytes of raw color data. Picture B, the photo stand-in, came out of PNG at 57.7 percent of its raw size (3,587,826 of 6,220,800) and out of JPEG quality 90 at 5.3 percent. If a real photo behaved the same way, the PNG would be around 20.8 MB and the JPEG around 1.9 MB. That is a rough projection from a synthetic picture, and real photographs vary a lot with their detail, but it explains why nobody emails PNG photographs and why a form with a 5 MB limit accepts the JPEG and refuses the PNG.

The reverse projection works for a screenshot. Picture A in PNG was 2.2 percent of its raw size. A screenshot saved as JPEG gains nothing, and a 256-color palette PNG made from it was smaller still, 76,023 bytes in my test, though that trick only suits images with few colors and is not something every converter offers.

Awkward cases where the rule bends

  1. A photo with a transparent cutout. PNG keeps the transparency but stores photographic noise, so the file can be huge. WebP handles the same job at a fraction of the size where it is accepted, compared in PNG vs WebP.
  2. A screenshot of a photo or a web page with a photo in it. Decide by the largest area. If the photo fills most of the frame, JPEG; if it is a small thumbnail inside a mostly flat page, PNG.
  3. A flat graphic with smooth gradients. Gradients in PNG can band or grow large. If the file is above a few hundred kilobytes and the destination does not need exact pixels, try JPEG at a high setting and compare.
  4. A photograph that came from a JPEG and needs to be a PNG. The PNG will be larger but not better; the damage is already in the pixels. Converting JPG to PNG only makes sense when something downstream insists on PNG.

When you do convert between them

PNG to JPEG shrinks photographs dramatically and costs transparency; JPEG to PNG grows the file and gains nothing visible. For the first direction, converting PNG to JPG walks through the settings. When in doubt, convert one representative file, put the two results side by side at full size, and trust your eyes over any rule, including these. Judge at 100 percent zoom, looking at the places that go wrong first: text edges, thin lines, flat sky, skin gradients. A saving of ten percent is not worth a visible flaw, and a saving of ninety percent often is. Also remember that JPEG limits each side to 65,535 pixels, which is rarely a concern, and that both formats store 8 bits per color channel in everyday use, so neither is the right container for a 16-bit editing master unless you pick PNG's 16-bit mode.

Not sure which suits your picture? Convert one copy to JPEG and one to PNG in the converter and compare the two sizes it shows.

Open the image converter