JPEG vs. PNG: When and why to use one format over the other

Adobe Lightroom CC iMac
Daven Mathies/Digital Trends

In the world of digital imaging, there are two image formats that prevail above all else: JPEG (or JPG) and PNG.

At first glance, a single image shown in both formats might seem identical, but if you look close enough, and dig into the data, there is quite a difference between the two. One format isn’t always better than the other, as each is designed to be used in specific circumstances based on your needs for image quality, file size, and more. Here’s what you need to know about both formats to make the most of their strengths and weaknesses.

JPEG

Short for Joint Photographic Experts Group — the team that developed the format — JPEG has become the standard compressed format in digital photography and online image sharing due to its careful balance of file size and image quality.

The exact ratio differs depending on the program and settings used, but the typical JPEG image has a 10:1 compression ratio. That is, if you start with a 10MB image and export it as a JPEG, you should end up with an image that’s roughly 1MB. Further, you should have almost zero perceptible difference in quality, although this depends on the content of the image.

To do this, JPEG relies on discrete cosine transform (DCT). While the math behind it is complicated, this compression algorithm takes a look at the entire image, determines which pixels in the image are similar enough to the ones around it, and merges the pixels together in tiles (groups of pixels that have the same value).

This method is extremely efficient but comes at the cost of throwing away information you can’t get back. JPEG images (with a few exceptions mentioned below) are lossy, which means after the image is saved, the data that was lost can’t be recovered. So, just like making a photocopy of a photocopy, each time you open and save a JPEG, it will look slightly worse than before.

For this reason, JPEG is not suggested as an archival image format, because if you ever need to open it and make edits again, you incur a loss of quality. Nondestructive photo editors, like Adobe Lightroom, can help skirt around this issue provided you never delete your original files, as they only save edits as metadata rather than writing over the original image.

JPEG should also be avoided with text-heavy images or illustrations with sharp lines, as defined lines tend to get blurred due to anti-aliasing. (Anti-aliasing is an intentional blurring designed to eliminate rough edges.) As you can see in the image below, a screenshot taken from our homepage, the text and white background show a lot of artifacts on the JPEG (right) compared to the PNG (left).

JPEG vs PNG

That said, there are times when you need to turn formats like PDFs into JPEGs. In those instances, it is best to ensure you export it at the highest quality settings to ensure all fo the text is sharp.

JPEG supports both RGB and CMYK color spaces in 24-bit, but its CMYK offerings leave much to be desired. (Modern printers handle RGB files just fine, so this isn’t a huge issue. You should still stick with higher-quality formats for printing, however.) An 8-bit grayscale is also an option but the compression ratios are far less impressive with grayscale compared to color images.

Over the years, many variations of JPEG have come and gone. For example, JPG-LS was designed to fix the issue of lossy compression, but it never gained a foothold and eventually fell to the wayside. JPG2000 also attempted to address the lossless issue, but it, too, failed to gain traction. BPG, a new format based on the h.265 video standard, was determined to take over JPEG, but never really caught on.

The creators of the JPEG recently shared a new format designed not to replace the JPEG but to exist alongside it as an option for faster streaming. In a JPEG XS, the compression is only six times instead of ten, but simpler algorithms mean the file is faster for tasks like streaming. A potential replacement could come in the form of HEIF, which is also based on the h.265 standard. Where others have failed, HEIF could succeed thanks to the support of one of the biggest brands in tech: Apple. It still has a ways to go, but may only be a matter of time before it is as widespread as JPEG is today.

Pros Cons
Small file size Lossy compression
Integrated EXIF support Not great for CMYK printing
Widely supported No transparency support

PNG

An acronym for Portable Network Graphics, PNG is a lossless file format designed as a more open alternative to Graphics Interchange Format (GIF).

Unlike JPEG, which relies on DCT compression, PNG uses LZW compression — the same as used by GIF and TIFF formats. Boiled down, PNG’s two-stage LZW compression takes strings of bits contained in the image’s data, matches those longer sequences to accompanying shortcodes held in a dictionary (sometimes referred to as a codebook) that is stored within the image file. The result is a smaller file that maintains high quality.

The biggest advantage of PNG over JPEG is that the compression is lossless, meaning there is no loss in quality each time it is opened and saved again. PNG also handles detailed, high-contrast images well. It’s for this reason PNG is more often than not the default file format for screenshots, as it can provide an almost perfect pixel-for-pixel representation of the screen, rather than compressing groups of pixels together.

One of the standout features of PNG is its support of transparency. With both color and grayscale images, pixels in PNG files can be transparent. This allows you to create images that neatly overlay with the content of an image or website. As seen in the GIF above, many editing programs — in this case Adobe Photoshop Mix — use a checkered background to indicate the transparency of a graphic. This makes PNG great for logos, particularly those with text, used on a website.

When it comes to photography, PNG might seem like a solid alternative to proprietary RAW formats for lossless image storage, but the truth is there are plenty of better alternatives, such as Adobe’s Digital Negative (DNG) — which you can even shoot on your smartphone — and TIFF. PNG also doesn’t natively support EXIF data, which includes information such as shutter speed, aperture, and ISO from the camera it was captured with.

PNG was made for the web and it has proven its worth. JPEG might be the format of a majority of the images, but PNG occupies an important niche that JPEG can’t effectively reach, and is basically the only choice when you need to clearly render a logo or text over other elements on a website.

Much like JPEG, PNG has also had a few variations throughout the years. APNG is a still-supported format designed to replicate the animated functionality of GIFs. It’s not nearly as prevalent but is supported by many modern browsers.

Another fun tidbit is that in the early stages of PNG’s development, it was suggested it be called PING, an acronym for “PING Is Not GIF,” a cheeky dig at the creators of the GIF format.

Pros Cons
Lossless compression Larger file size than JPEG
Transparency support No native EXIF support
Great for text and screenshots

Which one is better?

Ultimately, neither image format is better than the other. It’s simply a matter of which one is better suited for your needs.

If you’re wanting to share a photo from your camera on Instagram, Twitter, etc. your best bet is to use a JPEG. It’s smaller in size, it’s optimized for photography, and it’s widely supported across almost every platform and service imaginable.

If you’re taking a screenshot that you plan to annotate or archive for use later, PNG will better suit your needs. The file size might be larger than that of an equivalent JPEG, but you don’t have to worry about it losing quality with each new time it’s saved, and you know each pixel is as sharp as the last time you opened it. Most web graphics, like logos, are also better saved as PNGs since they can make use of transparent areas.

Mobile

Google Fi is getting support for the next-gen messaging standard, RCS Chat

Google has been pushing the development of the RCS Chat standard, and now it's finally bringing that new standard to its own carrier -- Google Fi. With Chat, customers will get features like read receipts, better group messaging, and more.
Computing

The Asus ZenBook 13 offers more value and performance than Apple's MacBook Air

The Asus ZenBook 13 UX333 is the latest in that company's excellent "budget" laptop line, and it looks and feels better than ever. How does it compare to Apple's latest MacBook Air?
Home Theater

Wireless headphones are finally awesome, and these are our favorites

With sleek form factors, prime audio quality, and the freedom of untethered listening, there has never been a better time to pick up a pair of wireless headphones. These are the best ones currently available.
Computing

Is it worth spending more for the Surface Pro, or is the Surface Go good enough?

The Surface Go versus Surface Pro -- which is better? While the higher price tag of one might make you think it's an easy choice, a deeper dive into what each offers makes it a closer race than you might assume.
Photography

The best mirrorless cameras pack all the power of a DSLR, minus the bulk

Mirrorless cameras offer a lot of photography firepower, inside a compact body. Explore the best mirrorless cameras, from the pro-level to the beginner-friendly shooters, in this guide.
Photography

This A.I.-powered camera follows the action to produce epic selfie videos

Want to capture more epic action selfies? The Obsbot Tail is a camera-gimbal combo that uses artificial intelligence to follow the action. Using a handful of different modes, the camera works to keep the action in the frame.
Photography

Sony crams its best camera tech into the new $900 A6400

Love Sony's autofocus, but can't stomach the full-frame price? The Sony A6400 mirrorless camera uses some of the same autofocus technology and the processor of the A9 in a compact, more affordable crop-sensor camera.
Photography

These point-and-shoot cameras make your smartphone pics look like cave paintings

If your smartphone camera just isn't giving you the results you're looking for, maybe it's time to step up your game. The latest and greatest point-and-shoot cameras offer large sensors, tough bodies, and long lenses -- something no phone…
Photography

GoPro bumps resolution on Fusion 360 cam to 5.6K with new firmware

Currently available in public beta, Fusion firmware version 2.0 offers a new 5.8K mode that results in 5.6K output when the 360 camera's two hemispheres are stitched together. It also adds support for 24 fps video and RAW time-lapse…
Photography

With 5-stop optical stabilization, Fujifilm GF 100-200mm is ready for adventure

Fujifilm revealed a new lens designed to deliver on the GFX system's promise of adventure-ready medium-format photography. The GF 100-200mm F5.6 R is a weather resistant, relatively lightweight, 2x telephoto with impressive stabilization.
Photography

Olympus teaser shares glimpse of OM-D camera that’s good for more than sports

Is Olympus about to release a new mirrorless camera geared toward sports photographers? The latest teaser offers a glimpse of an upcoming OM-D camera set to launch on January 24, and by the looks of the teasers, it's capable for landscapes…
Photography

Nikon A1000, B600 pack big zooms into compact, budget-friendly cameras

The new Nikon Coolpix A1000 packs in a 35x zoom lens, 4K video, and an optical viewfinder, while Nikon's B600 brings a 60x zoom lens to the table. The cameras are modest updates to Nikon's budget-friendly zoom models.
Social Media

Nearly a million Facebook users followed these fake Russian accounts

Facebook purged two separate groups behind more than 500 fake accounts with Russian ties. One group had ties to Russian news agency Sputnik, while the other had behavior similar to the Internet Research Agency's midterm actions.
Photography

From DIY to AAA, here's how to take a passport photo in 6 different ways

If you're applying for a passport or renewing one, you need to submit a photo in your official application. There are strict guidelines, but fortunately, it's something you can do at home. Here's how to take a passport photo.