What Image Size is Best for a Website

What Image Size is Best for a Website

This question is often asked by people who are new to publishing with WordPress. In this post, I’ll try explain what to take into account when choosing perfectly sized images for your website.

First of all we need clarification here. Are we talking about file size or image dimensions (e.g. width and height in pixels)? Yes, the bigger the image, the larger the file size. But don’t forget that there are many image file formats and types of compression. Same picture may differ in file size drastically if saved in different file formats or with different settings.  Let’s discuss one thing at a time.

Image Dimensions

Let’s see how WordPress handles image uploads. When you upload an image to your site it is saved to wp-content/uploads folder. WordPress also creates at least three more variants of that image: thumbnail, medium and large. There is also a post thumbnail (featured image). Its size is set in theme functions with set_post_thumbnail_size(). Besides default image sizes and post thumbnail, themes and plug-ins can introduce their own additional image sizes with add_image_size() function. Take a look at sample code from Twenty-Fourteen theme:

// Enable support for Post Thumbnails, and declare two sizes.
add_theme_support('post-thumbnails');
set_post_thumbnail_size(672,372,true);
add_image_size('twentyfourteen-full-width',1038,576,true);

What happens here is simple. First the support for post thumbnails is added. Then the size for thumbnails is declared. And after that, the new size “twentyfourteen-full-width” is introduced. So what we have right now is five registered image sizes:

  • thumbnail – 150px
  • medium – 300px
  • large – 474px  (Equal to content width of the theme)
  • post_thumbnail – 672×372 px
  • twentyfourteen_full_width – 1038×576 px

This means that upon every upload five more variants of different size of the image will be created. At this point, it may seem pretty straightforward. You keep in mind the largest (1038×576 px) and make sure that the images you upload are wider than 1038px and taller than 576px. But it is not as simple as that.

Retina Screens

Well, maybe it was that simple before introduction of Retina displays (or HiDPI displays). But today this approach is outdated. You need to take into account that many of your site visitors may have displays with higher Pixel Density. For better understanding of the concepts of modern Web graphics, you need to know the difference between Device Pixels, CSS Pixels, and Bitmap Pixels. There is a very good article  by Smashing Magazine that explains these notions in a very understandable way.  But in a few words, on a normal display one CSS pixel takes the physical surface of one Device pixel while, on Retina display, one CSS pixel takes four Device pixels. Clearly the image sizes are set in WordPress in CSS Pixels. What does it mean in terms of uploads? Well, it’s simple. Just make sure that images you choose are at least two times wider and two times taller than the largest image size registered by your theme. In the case of Twenty Fourteen, it is 2076×1152 pixels.

Future Proof Uploads

As stated above in Twenty Fourteen the largest registered image size is 1038×576 pixels. Nothing against Twenty Fourteen, it’s a great theme, but what if you decide to change it after some time? And in your new theme the largest registered size will be, let’s say 1120×600 pixels. Even if you regenerate all image sizes after theme switching, there will be no retina-ready images for the largest registered size because our uploads were 2076×1152 pixels, remember? And now we need 2240×800 pixels. This can be a serious issue if you have a big library of images. So what is the best size for the uploads? Let’s think about it this way.

Many themes have a full-width page template or full-width slider on the homepage. This means that probably the largest registered image size will be equal or almost equal to the site width. 

But how wide sites are now and how wide will they be in the future, you might ask? That’s a good question. Theme developers create their themes with the grid systems that rely on most popular screen resolutions at the moment. I’m not talking about mobile devices right now because we need to find out the maximum possible width of the website, viewed from a desktop computer.

Around two-three years ago one of the most widely used grid systems were 960.gs. It was targeting all popular screen resolutions from 1024×768. Now when 1024×768 is almost gone, 1140 pixels grid is becoming more and more popular. Taking into account Retina displays, this makes the good size for uploads above 2280px width. I am saying above because, even though, 1140px grid is widely used and future-proof, it is good to have some extra space to breathe.

Usually, my uploads are always around 3000px wide whenever possible. It makes me feel kinda safe, knowing that even if I change my theme in the future and regenerate all the thumbnails, they will still look good on any screen.

File size

Talking about file sizes, I recommend following the rule: As small as possible, as large as necessary. Take a look at the example images below. Open them in separate tabs and try to notice the difference.

Of course, it also depends on the given image, but while the visual difference between png and 80% quality jpeg is hardly noticeable, in file size they differ tremendously. This single png will use almost 4.5 times more bandwidth.  And that’s for one image and one visitor. But what if you have 10 visitors or 100 visitors or 1000 visitors, you got the idea. Don’t get me wrong , there are situations where png images are essential. But for general uploads, jpegs are much better in terms of filesize.

Conclusion

Summing everything up, I want to say that I did not have any image-size-related troubles using the principles stated above. If you have any questions, feel free to ask them in the comments.

Cover image by David Holt.

Table of contents

Want some more tips on image management in WordPress. Here is the list of articles that will help you do it faster and less painful. If an article is not clickable this means it has not been published yet. Check back later, and don’t forget to subscribe to my Twitter.

  1. Better Image Workflow in WordPress
  2. What Image Size is Best for a Website
  3. Tips For Better Filenames in WordPress
  4. Batch Rename Files in WordPress
  5. Make Use of Image Metadata in WordPress
  6. How to Make Images Retina Ready in WordPres

11 Replies

  • Thanks for this explanation. I’m trying to get my “large” size to equal your suggestions, but it only goes to 474px. I checked my settings, and it’s listed as 1024px. Is this limited somewhere else? I use Twenty Fourteen theme – Visit50.com. Thanks so much for your help!

    • Hey Todd, nice catch! You are right, “large” image size is equal to the content width of the theme. Fixed that. In case of Twenty Fourteen it is 474px. So you are good. Your photos are great by the way!

      • Hi Dmitry, thanks so much for the kind words!

        So does that mean 474x is the max size I can post? Is there a way to increase the canvas size? It seems like there’s a lot of white space that can be used to help photography really pop.

        If it’s not built to alter the 474x max in my theme, I assume that means I should start uploading photos at 474x max, since anything above that is just wasted file size. Agreed?

        Thanks so much for weighing in, I appreciate it!

        • No problems! I understand you have many images on your website, and want to optimize the process. So:

          Is there a way to increase the canvas size?

          Well, there are few things that I can think of from the top of my head. The simple approach would be to create a child theme for Twenty Fourteen, and make changes to CSS altering content width. That would require some CSS and PHP skills. No rocket science though.

          And the second approach would also be through child theme. But in this case it will involve creating a special container class for images with negative margins that will fill the whole white space, leaving the actual content width intact. However this approach is a little bit more complex and will need some testing.

          … I assume that means I should start uploading photos at 474x max …

          This only a part true. You might want to change the theme in the future, and if your new theme will have larger content width, your pictures will look blurry. And you’ll not be able to regenerate thumbnails, if you don’t have larger original images on the server. Also don’t forget about Retina screens.

          If disk space is an issue I would suggest using jpeg compression at about 80% which is not that terrible (arguably) but stick to at least 1500-2000px wide. Also to make pictures load faster and save bandwidth you may use Jetpack’s Photon module.

Leave a Reply

Your email address will not be published. Required fields are marked *