Images on the web come in many formats, such as JPEGs, GIFs, PNGs, and more. In fact, there are so many acronyms that keeping track of them can be complicated – never mind figuring out which is the best image format to use on your website.
It is important to put some thought into this matter, however, since the formats you use for your site’s images have an impact. Some types of graphics look better and don’t occupy as much storage space, for example, which translates to better performance without a loss in quality.
Why the image formats you use matter
As we’ve mentioned, there are dozens of image formats to choose from. However, when it comes to the web, most people stick to a handful of standbys, including JPEGs, PNGs, and GIFs.
We’ll talk about what makes each of these image types unique in a moment. For now, let’s break down why the format(s) you use on your website matter in a more general sense.
The types of images you use affect your site’s:
- Performance. Some image formats take up more space than others, which can affect your site’s loading times.
- Appearance. As you might imagine, some image formats include more detail and are higher-quality than others.
- Scalability. When you stretch or shrink an image too much, its quality will suffer. How much leeway you have depends on the image format you use. This affects your site’s ability to look good on both large and small screens.
In most cases, you’ll want to stick to using one or two image formats throughout your website, to maintain a consistent standard. The formats you choose should ideally provide a nice balance between quality and performance.
The 3 primary image formats used on the web
As we mentioned earlier, there are some image formats that are used much more commonly online than others. The three options we’re going to introduce below are some of the most popular and useful formats, which makes them perfect picks for almost any website.
The term JPEG stands for Joint Photographic Experts Group, and it was coined in 1986. The main benefits of this format are that it can display millions of colors, and it’s particularly well-suited to high compression levels.
In general, JPEG is an excellent option for displaying complex photographs that include a lot of colors. Here’s a quick example:
Although JPEGs hold up well when compressed, you can usually notice a small drop in quality after optimizing images. Though, this all depends on the level of compression that’s selected for the image. The quality drops aren’t often noticeable unless you’re looking very closely.
On the other hand, JPEGs are not perfect for images with very few color data, like interface screenshots and other simple computer generated graphics. We’ll cover this more when talking PNGs in the next section:
Portable Network Graphics (PNGs) are just as popular as JPEGs on websites. They also support millions of colors, although you’re much better off using PNGs for images that contain less color data. Otherwise, your image is going to be ‘heavier’ than the same image saved as a JPEG.
Here’s an example of a PNG image:
This is a screenshot of the WordPress dashboard. PNGs do a great job when you have an image with rapid transitions between colors that need to remain sharp. For example, when you’re taking a screenshot of a user interface where different interface elements strongly transition between dark and light backgrounds, it’s much better to use PNGs. Like this part here – the transitions between the white, gray and blue:
Saving the image as a JPEG could result in blurry edges and overall distorted presentation.
One more advantage of PNGs is the fact that they support transparency. This makes them a fantastic option for logos and icons in particular. Here’s a quick example of the ThemeIsle logo in PNG format, with a transparent background:
Overall, compressed PNGs are also better when it comes to retaining quality – due to the lossless compression algorithm used with PNGs vs the lossy algorithm that’s popular with JPEGs.
Unlike the two formats we’ve talked about so far, Graphics Interchange Format (GIFs) have far more specific use cases. Although you can have a static GIF image, most people use this format to showcase animations, such as this one:
JPEGs and PNGs don’t generally support animations (although there is a format called Animated Portable Network Graphics – APNGs). That makes GIFs very useful. As you can imagine, however, these types of images weigh a lot, due to the many frames they contain.
You can optimize GIF files, but in most cases the results won’t be as good as with other image formats. That means you should aim to use GIFs sparingly throughout your website, only when you need to showcase an animation you can’t create any other way (such as with CSS).
On top of that, GIFs only support up to 256 colors, as well as transparency. That makes them a poor choice for displaying complex images. To make that point even clearer, here’s the same graphic we showed you in the previous two sections, only now as a non-animated GIF:
Not only does it look terrible, but it weighs a hefty 825 KB. This is why using GIFs for static images is generally not advisable.
How to choose the best image format to use on your website
On most sites, either JPEGs or PNGs make an excellent choice for the bulk of your images (although it’s best to stick with one over the other for consistency’s sake). As for GIFs, you’ll want to reserve those for situations when you need to display animations.
More specifically, JPEGs can enable you to squeeze a bit more performance out of your web pages, due to their high compression ratio, but only if you’re using them for color-heavy images – like all photographs, basically. If you want your site to load as fast as possible, and you don’t mind sacrificing a bit of image quality, JPEG is the best image format for your needs.
However, if you care more about ensuring that all your images look as good as they can, we’d recommend that you go with PNGs instead. This image format retains its high quality even when compressed, and works for both complex and simple images.
You have a lot of options when it comes to what types of images you can use on your website. Ideally, you’ll pick whichever formats enable you to display high-quality images without slowing down your site significantly. If you’re a WordPress user, you’ll be glad to know that WordPress supports all the most popular image formats out of the box.
When deciding which is the best image format for your needs, here’s what you’ll want to consider:
- JPEG: This is an ideal image format for all types of photographs.
- PNG: This format is perfect for screenshots and other types of imagery where there’s not a lot of color data.
- GIF: If you want to show off animated graphics on your site, this is the best image format for you.