When Should You Use Which Image Format? JPG? PNG? SVG? (2024)

When Should You Use Which Image Format? JPG? PNG? SVG? (2)

There is a room that contains all there is to know about images. The door to it is locked. Most of us have casually peered through its keyhole or witnessed light of various colours and brightness spilling from it. If you are granted a guest pass to the room, beware. Akin to JK Rowling’s Triwizard Maze, you are likely to get lost in its twisting passages, or be usurped by something surprising along the way.

Most of us know that when building stuff for the web, optimising HTML, CSS, JavaScript or whatever else is good — but if you don’t optimise images, all other efforts will be in vain.

I’ve always been in love with pictures but knew little of the technical details behind them. Now I realise there are more of these details than you or I would ever have expected.

This article barely scratches the surface of web image choice. Beyond its scope (to name but a few) are things like the maths behind image formats, GIFs, TIFFs, BMPs, use of fallback images, dots per inch, the webP image format, decreasing image requests, image metadata, image scaling, browser rendering differences, automated optimisation tools, saving for the web, sprites, lazy-loading, the picture element, srcset, re-use of images throughout a site, etc.

Here are a few questions to ask yourself that may help you plot a basic map of one tiny corner of the image room — whether to use PNG, JPG or SVG image formats. Of course, as usual, it depends, and you may not get it perfect but you can, and should, damn well try! ;)

PNG-8 limits you to 256 colours, which is enough most of the time, has by far the smallest file size, but may exhibit “banding” of colours. If you need more colours or want to avoid banding, consider PNG 24 or 32, but be aware of huge increases in file size. JPGs can contain millions of colours and have much smaller file sizes, but are best for photos where there are no crisp lines or text. For pictures with crisp lines or text (e.g. a graph), stick with PNG and compromise on the number of colours you use. Replace PNG with SVG for simple line drawings, logos and icons.

Bonus fact: the way PNGs are structured means two near-identical files that are separated only by a size difference of a few pixels may differ dramatically in size.

JPGs don’t offer this (although some people came up with clever hacks to merge SVG with JPG to make a transparent JPG — see here). PNGs and SVGs support transparency. PNG-24 will likely give better quality than PNG-8, tempting you to create a large file. SVGs are transparent by default and can be a lot smaller.

JPGs are lossy meaning they lose quality when compressed or saved, plus they are raster-based meaning they don’t scale well. They are best used for more complex photos that have many colours — not illustrations, logos, web comics etc., where sharpness of every line is important. Another good thing is that you can selectively blur parts of a JPG, leaving more important parts sharp, but shaving more of the file size off. PNGs are lossless, so don’t lose quality when compressed or saved. This makes them a good alternative to JPG when you need crisp lines or text. However, they can be large in size and are also raster-based so won’t scale well. SVGs are vector-based and scale incredibly well, remaining sharp at any size, but aren’t suited to photos or more complex graphics.

On retina screens, JPGs rarely look good and PNGs have trouble scaling. SVGs look good and will scale. Support for JPG, PNG and SVG is good across all browsers, and there are work-arounds available for older browsers (e.g. IE6 to IE10). There are ways to provide back-up images to help browsers choose which format and size of image to render, depending on screen size and resolution — but these deserve their own dedicated article.

JPG — lossy and raster-based, use for photos and images with loads of colours where crisp lines aren’t absolutely essential. They won’t support transparency, although there are ways around this.

PNG — lossless and raster-based, use for images that need crisp lines or text (but do not need to scale), need transparency, have few colours. There are PNG8, 24 and 32 — research the best to use for your specific case (see this great article)

SVG — vector-based, use for flat line drawings, icons, logos that’ll scale to any size while file size remains small.

For some heavy reading on JPG and PNG science, click here and here. These articles blew my mind!

Choosing image format is only one step towards optimising images on the web. There are many, many other steps to consider, and so, so much to learn! I hope you feel brave enough to explore more corners of the image room — it’s courageous people like you who will pave the way for the excellent web experiences of the future ;)

Also published on my site.

When Should You Use Which Image Format? JPG? PNG? SVG? (2024)

FAQs

When Should You Use Which Image Format? JPG? PNG? SVG? ›

JPGs can contain millions of colours and have much smaller file sizes, but are best for photos where there are no crisp lines or text. For pictures with crisp lines or text (e.g. a graph), stick with PNG and compromise on the number of colours you use. Replace PNG with SVG for simple line drawings, logos and icons.

When to use JPEG and when to use PNG? ›

Because of their different compression processes, JPEGs contain less data than PNGs — and therefore, are usually smaller in size. Unlike JPEGs, PNGs support transparent backgrounds, making them preferred for graphic design.

Which image format should I use? ›

JPEGs (or JPGs) work best for web photos, while PNGs might be a better choice for logos or simple graphics. GIFs are great for animations; however, they offer fewer color choices than PNGs.

When should you use SVG? ›

Scalable Vector Graphics (SVGs) work well for logos and graphics because you can scale them up or down for different purposes. They're also a popular choice in web design because search engines like Google can read their XML programming language. This helps with SEO and website rankings.

When would displaying a JPG file be more effective over an SVG? ›

SVG vs PNG vs JPG

SVG is the most efficient format when it comes to simple graphic illustrations. JPGs are the best format for photographs due to their small file size which results in faster loading times. PNGs, on the other hand, provide the best image quality (although they do have a larger file size than JPGs).

When to use PNG vs JPG vs SVG? ›

JPGs can contain millions of colours and have much smaller file sizes, but are best for photos where there are no crisp lines or text. For pictures with crisp lines or text (e.g. a graph), stick with PNG and compromise on the number of colours you use. Replace PNG with SVG for simple line drawings, logos and icons.

What is JPG best for? ›

JPG format is best used in the case of complex images with no text. By its nature, . JPG reduces loading times by selectively deleting elements of a photo. This is great for large detailed photographs that would otherwise take very long to load.

What are the 4 types of image formats? ›

Common image file types
AbbreviationFile formatFile extension(s)
JPEGJoint Photographic Expert Group image.jpg , .jpeg , .jfif , .pjpeg , .pjp
PNGPortable Network Graphics.png
SVGScalable Vector Graphics.svg
WebPWeb Picture format.webp
3 more rows

Which image format is commonly used? ›

JPEG files are very common on the Internet and JPEG is a popular format for digital cameras - making it ideal for web use and non-professional prints.

Is it better to save pictures as PNG or JPG? ›

If you want to have the smallest file size possible, and maximize your space, then you should probably go with JPG images. They traditionally use a 10:1 compression ratio. While PNG images are higher quality, they are also much larger once the compression image is done.

Why use SVG instead of PNG? ›

SVG images are vector-based, which means they can be scaled up or down without losing quality. This makes them an excellent choice for responsive web design, where images need to adapt to different screen sizes and resolutions. PNG images, on the other hand, are raster-based and can lose quality when scaled.

What is SVG not good for? ›

While the SVG format is perfect for simple graphics and illustrations, it may not be the best choice for more complex images, such as photographs.

What is the SVG format used for? ›

The SVG file format is a popular tool for displaying two-dimensional graphics, charts and illustrations on websites. Plus, as a vector file, it can be scaled up or down without losing any of its resolution. Learn more about the key features of SVG images, their pros and cons and how the SVG format has evolved.

When to use PNG? ›

If you need high-quality, lossless images — particularly for digital graphics, logos, and web design elements — then use a PNG! This format is also excellent for images that need to be partially transparent or if you plan on doing multiple edits, as the format doesn't lose quality with multiple saves.

Is PNG or JPEG better for emails? ›

By having a file that is both compressed and visually pleasing, emails will load faster and create a better experience for users. While JPEGs are perfect for photos, they're not an ideal choice for logos, graphics, or text. PNGs, on the other hand, provide a clear, crisp option for all three.

Can I use PNG in emails? ›

When using PNG in emails the rule of thumb here is to choose whichever format is an appropriate balance of color and file size for your particular needs. PNGs are also capable of producing background images without jagged edges.

Is it better to upload JPG or PNG? ›

JPEG's smaller, compressed file size gives it an edge for website use, as faster loading times contribute to a smoother user experience and improved SEO ranking. However, PNG's support for transparency can make it the ideal choice for including graphics, such as logos and icons, on websites.

Should I save my art as PNG or JPEG? ›

PNG: PNG is a good choice for storing line drawings, text, and iconic graphics at a small file size. Unlike JPGs, which create a heavily compressed file and may blur images at a certain point, a PNG file will always look at least as sharp as the original image because of its “lossless” compression process.

What do PNG files offer that JPG files do not? ›

The simple answer is that PNGs offer lossless compression and JPEG files don't. This means, unlike JPEGs, PNGs don't lose any of their image data when they're compressed. On the flipside, lossless compression tends to make PNGs much bigger files than JPEGs, so they require more storage space.

What is the best format for photo printing? ›

You should use a JPEG when…

You want to print photos and/or artwork. At high resolution files with low compression, JPEGs are perfect for editing and then printing. You need to send a quick preview image to a client. JPEG images can be reduced to very small sizes making them great for emailing.

Top Articles
Buy Gift Cards Online In Nigeria.
The Mystery of the Fire Dragon (Nancy Drew Mystery Stor…
Netr Aerial Viewer
Gamevault Agent
Hocus Pocus Showtimes Near Harkins Theatres Yuma Palms 14
Free Atm For Emerald Card Near Me
Craigslist Mexico Cancun
Hendersonville (Tennessee) – Travel guide at Wikivoyage
Self-guided tour (for students) – Teaching & Learning Support
Doby's Funeral Home Obituaries
Vardis Olive Garden (Georgioupolis, Kreta) ✈️ inkl. Flug buchen
Select Truck Greensboro
How To Cut Eelgrass Grounded
Craigslist In Flagstaff
Shasta County Most Wanted 2022
Energy Healing Conference Utah
Testberichte zu E-Bikes & Fahrrädern von PROPHETE.
Aaa Saugus Ma Appointment
Saritaprivate
Geometry Review Quiz 5 Answer Key
Walgreens Alma School And Dynamite
Bible Gateway passage: Revelation 3 - New Living Translation
Shadbase Get Out Of Jail
Gina Wilson Angle Addition Postulate
Celina Powell Lil Meech Video: A Controversial Encounter Shakes Social Media - Video Reddit Trend
Walmart Pharmacy Near Me Open
Dmv In Anoka
A Christmas Horse - Alison Senxation
Umn Biology
Obituaries, 2001 | El Paso County, TXGenWeb
Cvs Sport Physicals
Rogold Extension
'Conan Exiles' 3.0 Guide: How To Unlock Spells And Sorcery
Colin Donnell Lpsg
Teenbeautyfitness
Weekly Math Review Q4 3
Facebook Marketplace Marrero La
Nobodyhome.tv Reddit
Topos De Bolos Engraçados
Electric Toothbrush Feature Crossword
Gregory (Five Nights at Freddy's)
Grand Valley State University Library Hours
Holzer Athena Portal
Hampton In And Suites Near Me
Costco The Dalles Or
Stoughton Commuter Rail Schedule
Bedbathandbeyond Flemington Nj
Free Carnival-themed Google Slides & PowerPoint templates
Otter Bustr
Used Curio Cabinets For Sale Near Me
San Pedro Sula To Miami Google Flights
Selly Medaline
Latest Posts
Article information

Author: Nicola Considine CPA

Last Updated:

Views: 5798

Rating: 4.9 / 5 (69 voted)

Reviews: 84% of readers found this page helpful

Author information

Name: Nicola Considine CPA

Birthday: 1993-02-26

Address: 3809 Clinton Inlet, East Aleisha, UT 46318-2392

Phone: +2681424145499

Job: Government Technician

Hobby: Calligraphy, Lego building, Worldbuilding, Shooting, Bird watching, Shopping, Cooking

Introduction: My name is Nicola Considine CPA, I am a determined, witty, powerful, brainy, open, smiling, proud person who loves writing and wants to share my knowledge and understanding with you.