Website image size guidelines 2021 – Updated: 04 Feb, 2021

The topic of resizing images for the web is a relatively simple, yet ridiculously complex one, at the same time. And it's also one where there is an awful lot of misinformation floating around, even from professionals. But a lot of people have a need for basic foundational skills when it comes to understanding and resizing digital images for various purposes. Hence this post…

Huge caveat here: My primary field of knowledge is in photography. I have been fiddling with cameras my whole life, and have taught photography and digital imaging at local colleges and independently for the last ten years (visit iTeachphotographers for more on that), and I feel like I have a  reasonably authoritative voice on the topic. I also design, host and maintain WordPress websites. While I can read and write HMTL and CSS, I am more a designer than a coder, and I don't profess to be know everything about the technical intricacies of web design. And I certainly don't profess to knowing everything there is to know about pixels either, particularly about pre-press and the printing industry. So if, in spite of my experience and research, I am misinformed or mistaken about some point or other, I welcome any corrections.

Only Pixels Matter

Pixels

This is a great starting point. Digital imaging capture devices (aka cameras, but also scanners) have a fixed number of pixels they can capture in one image. A Canon EOS 5D MkIII for example can capture an image at 5,760 x 3,840 pixels. If we multiply those together we get 22,118,400 pixels, which reflects that it is a 22 Megapixel camera (22 million pixels).

A Nikon D800 captures a whopping 7,360 × 4,912pixels (a 36.3MP camera). The top of the line Phase One Digital Camera back, the IQ180, captures a staggering 10328 x 7760 pixels (over 80 million pixels!). So, pixels are finite and are linked to the capture device. Pixels are our starting point. They are the raw material of our images, whether we are are printing or just displaying the image on a screen.

The other main player in the story is resolution. Resolution has many different meanings, and is quite complex when you look into it. Broadly speaking though, resolution is basically referring to the detail an image has. The higher the resolution, the more detail there is. But in this article, the main type of resolution concept I want to introduce is called pixels per inch, otherwise known as ppi. The best way to think about how resolution works together with the number of pixels captured in an image, is that "the number of pixels is determined by the capture device, but pixels have no fixed size". A pixel is a unit of a digital image, but overall resolution depends upon the size of the pixels (and the viewing distance). The smaller the size of a pixel, the higher the resolution of the image will be and the clearer the image will be.

PPI vs DPI

Before we go any further, I think it's important to clarify the oft misused terms dpi and ppi. DPI is a printing term, and it stands for DOTS PER INCH. Printers lay their ink down in dots, and this figure is not the same as PPI. Dots have space in between them, and pixels don't. DPI doesn't have any real relevance to our discussion today.

PPI on the other hand, which stands for PIXELS PER INCH, is a term that relates to digital images. Pixels, or picture elements, as we have established, are what digital images are made up of, and are square. The terms DPI and PPI are NOT interchangeable, and PPI is the correct term to use when talking about digital images. I'm not going further into the whole DPI / PPI thing here, but there are some good articles going into much detail on this subject here, here and here.

How Pixels and PPI hang together

So before we look at images for the screen, it will be instructive to look quickly at Photoshop's Image Size Dialog, to see how the resolution (ppi) of an image interacts with the pixel dimensions when printing an image.

As you can see here in the Photoshop Image Size dialog, Figure 1.1, digital image information is presented. The Dimensions section shows the aforementioned pixel dimensions of the image, in this case 3840 x 5760. This dialog can be used in many ways, but what I want you to take note of is the physical dimensions listed (12.8″ x 19.2″). This shows us the physical size of the image if it were to be printed, by taking the number of pixels, and dividing it by the number of pixels per inch. In this example, we have 5760 pixels on the longest length, and if we divide that by 300 (the PPI) we get an image of 19.2 inches.

What this shows us is that print size is simply a result of how tightly we squash together the pixels we have. If we increase the ppi, say to 400, without resampling the image (adding to or removing from the total number of pixels), the document size goes down to 14.4 inches. If we spread the pixels further and reduce the ppi to say 240, it becomes a 24 inch document. This what I mean when I say pixels have no fixed size.

resizing images for the web

Figure 1.1 (click for larger view)

Resampling

To consider resampling, let's use a simple example. If we wanted to print an 8″ x 12″ print from the image this dialog represents, how do we go about resizing it correctly?

Firstly, we have to understand what resampling is. In a nutshell, resampling is resizing an image by reducing or increasing its number of pixels. So, if we want to change the size of the print but keep the resolution at 300 ppi, which is a common standard from a lot of professional photo labs, we simply type the new dimension into the dialog, and Photoshop will throw away or create the needed number of pixels to get the dimensions to work. Now look at Figure 1.2 below. If, for example, we type 12 inches into the height field, the resultant dialog would look like this. Note how changing the height to 12 from 19.2 has two effects. One is that the width now becomes 8. This is simply because the aspect ratio of the image (2:3) is the same aspect ratio as an 8×12″ print, so changing one to 12″ means the other one automatically becomes 8″. If the image did not have the same aspect ratio as our desired 8 x 12″, then cropping would be needed instead, but that's another story for later.

resizing images for the web

Figure 1.2 (click for larger view)

The second change we can see is that the pixel dimensions have changed. Photoshop has thrown the un-needed pixels away (by way of a very complex algorithm no doubt), resulting in an image that is now only 3600 pixels on the longest length. This gives us the correct relationship between the document dimensions, the resolution and the number of pixels. 3600 pixels, spread out at 300 pixels per inch gives us 12 inches of image. If we were to change the resolution of the image with resample ticked, the document size would remain the same, and again, the pixel dimensions would be altered to suit.

A final note here is that we can always change the resolution of an image without it affecting the number of pixels in the image. This is important to grasp. The resolution (ppi) is simply a printing instruction. If we change the resolution without changing the number of pixels in an image (by making sure Resample Image is unchecked), we DON'T change the size of the file either. The only two factors controlling file size are number of pixels and image format and compression (OK, there's arguably a third factor which is the amount of detail in the photo, which affects compression). When we uncheck the Resample Image checkbox, the pixels are greyed out in the dialog box and the only thing that can change when changing the ppi is the document size. And as I've said, this has no effect on file size. But it is useful and important to be able set the desired ppi when printing to different devices, and doing it this way doesn't affect the pixels.

The 72 ppi Myth

resizing images for the web

You might have heard the suggestion that it's important to save images for web at 72 ppi (or God forbid, dpi). The reasons for this are given as many:

  • It reduces the file size – Absolute Rubbish. PPI doesn't affect file size at all. Compression does.
  • That's what resolution screens are at – You don't have to match the image ppi with the screen ppi. And besides, most modern monitors are more than 72 ppi anyway.
  • It's the industry standard – This is probably the best argument of the lot, as it is a sort of industry standard. It's just that it's an industry standard for no good reason.

In fact, it is not important at all to set images to be 72 ppi for the web. It doesn't hurt, but it's not important. The ppi of an image makes no difference to the file size and neither does it make any difference to the visual appearance of an image on a monitor. It would of course have an effect on how big an image was printed as it is a printing instruction, but when viewed in a browser, it is the monitor itself that determines how much space the pixels take up on the screen. Let's look at the three images below. The first has been saved at 72 ppi, the second at 300 ppi and the third at 1000 ppi. See any difference? No, of course you don't. They all share the same physical pixel dimensions (300 x 450 px), and that's the only thing the browser cares about, so the logical instruction of ppi makes no difference unless we print them. So hopefully, that's all you need to put that old chestnut to bed. PPI has no effect on file size, and neither does it affect on-screen appearance.

resizing images for the web

Asher @ 72ppi, file size: 18.3kb

resizing images for the web

Asher @ 300ppi, file size: 18.3kb

resizing images for the web

Asher @ 1000 ppi, file size: 18.3kb

The Origins of the Myth

Where the 72 ppi myth originally comes from is that screen resolution of the first Macintosh computers back in the mid 80s, used to be 72 ppi (read more here). But it's not a fixed number and nowadays it's a lot more on most monitors. Some screens are around 96 ppi, some are up around 120 ppi, while the latest screens on tablets are achieving mind blowing resolutions of over 500 ppi (Retina eat your heart out). To figure out exactly what resolution your monitor has, simply measure the width of the screen area in inches (not the whole monitor) and then find out what the native resolution is. My monitor's native resolution is 1920 x 1080 (full HD) and my screen width is 18.622 inches. This gives me a screen resolution of  just over 103 ppi. In other words, 103 pixels in an inch of screen real estate. Just to be thorough, I tested this by resizing an image to 1030px and opened it. And yes, it measured exactly 10 inches across on my screen. This is an area of much debate, and it is generally print designers who argue about these numbers. Design is not just screen based, and ppi and dpi have major implications in the print world. But my essential point remains. For web based viewing of images, it's the screen resolution, in conjunction with the number of pixels, that determines how big the image is displayed on a  monitor, not the inbuilt ppi instruction in the image. Another very interesting article discussing this topic is The Myth of DPI. It has its own inconsistencies (a pretty big one even in the title, as he confuses dpi with ppi from the start) but it is essentially a good read. Even perhaps more interesting and informative than the article itself though, are the comments. There are loads of them, many from quite educated graphic designers with a wealth of knowledge, and the discussion gets quite heated at times. If you have a spare half an hour and the interest, you will learn a lot by reading the various perspectives of web and print designers, and those whose workflow does require a bit more consistency and awareness about the ppi of images.

Resizing images for the Web

When you understand that there is no real need for setting the ppi in images destined for the web, resizing becomes a lot simpler. Basically, you resize the image in pixels at the size you want it to display. Did I say simple? Well unfortunately, here we enter a completely different world of pain, that of pixel based web design. But at least you don't have to worry about ppi ;). If, for instance you had a WordPress or HTML template that you know is 1100 pixels in width and you wanted an image to fill the content area, then around 1100 pixels in width would be a good size. With resizing images for the web, the number of pixels is the only relevant detail. Forget the ppi of the image, and remember it's website theme, the resolution of the screen and the number of pixels in the image that will determine the size of the presented image on screen (disregarding CSS and Retina and some JavaScript at this point). You could argue that it makes sense to set the ppi to 72 anyway. Fair enough, I suppose. It would give consistency. I only rail against the mistaken belief that it is important to do so. If you use Save for Web in Photoshop, you might find it doing it for you anyway. A quirk of the software is that if you save the image with metadata, it won't change the ppi (as that's in the metadata), but if you strip the metadata out when saving (by choosing None), and then open the image in Bridge or Photoshop again, you will see that it's now set to 72 ppi. I believe this is because the field can't be empty, and so Save for Web just puts in the default value (which Adobe has set at 72 ppi). I use Photoshop to resize my images, but you can use virtually any decent image editor. You can even do it online with services like http://www.shrinkpictures.com/ and http://www.picresize.com and many others.

Image Resizing and Screen Resolution

Let's come back to screen resolution, as it majorly affects how big or small we resize our images. One of the biggest difficulties for web designers over the last decade or so was always what size images should be. Web design is a mixture of rendered, flexible elements like text and fixed, pixel based elements like images. Screen resolutions come in all sorts of sizes, but to design a web site with pixel based elements, you have to determine how wide your content area is going to be. There's no point putting a 2000 px wide image in a webpage if 90% of the population are using screens with a  maximum 1024px resolution. The image is just going to be too big to be seen on the screen. So determining your audience and designing to them was always a big part of the process. It has been changing a lot though in the last decade. You can define image size with CSS or HTML (i..e upload an image that's 800px wide and tell the browser to display it at 400px wide), and there are also java scripts that can automatically resize an image to fit different screen resolutions and new vector based formats like svg are coming through. But designing for the most common resolution of the day is still a major consideration. The most common resolution today is 1366 x 768 (http://www.w3schools.com/browsers/browsers_display.asp) but with the explosion of different form factors, even that particular resolution has only 34% share. Obviously with responsive templates and the like, a lot of changes are going on in the web design space when it comes to images and how to deal with them. But the most basic part of getting started in this area is understanding that unless you have a technology at play that will repurpose images on the fly, you are best off resizing your images to fit your template and your audience. If you look at the current WordPress templates for example, most have a content container width of around 1100 – 12000px. This is to ensure that the content container will never exceed the resolution of the screen. As less than .5% of all desktop users have resolutions less than 1024px, this is a safe bet. In the next year or two, my guess is we'll see a jump to 1300px or so, as 1024px resolutions now comprise only 2% of users, while Retina style resolutions are increasing quickly. For years I had a photoblog, and I uploaded photos several times a week. It was my practice to upload images at 800px width if they were landscape oriented, and 650px if they were portrait. At the time, that meant that the images would largely fill the screen of up to 95% of my audience. These days, an 800 px image on 27″ iMac looks rather small. But it would still look pretty good on most laptops and tablets. Retina displays have made things even more complex.

CSS and JavaScript

Another complexity I am going to very quickly touch on, is CSS and Javascript. With CSS you can tell an image to fit a certain percentage of the container, and with some javascript (Lightbox and the like) has the ability to dynamically increase or decrease the size of the image depending on the resolution of the screen. I don't know a whole lot about this side of things, not being too much of a coder, but I can see a time when we just upload a large image and the code helps us display it in all all sorts of sizes, We're pretty much there already, but not quite. You can also use HTML as I've said earlier to display an image at a size other than it's original size. Trouble with this, is you often get artifacts (jagged lines) and lose quality in the image. You are also downloading a bigger file, only to present it at a smaller size. Responsive templates obviously do this sort of thing today, as images get squished down to fit on a  tablet or  mobile phone. All this sort of dynamic resizing is way beyond the scope of this article, and any knowledge I have, so I invite someone who knows about that side of images for the web to step up and educate us all with a similar article.

The 'Export As' Dialog

Compressing & Resizing images for the web

resizing images for the web

The recently renamed 'Export As' dialog (previously known as Save for Web) in Photoshop is a tool for compressing and resizing images for the web. It outputs to one of four file formats, gif, png and jpg, plus, most recently, svg. Let's start with the most commonly used format, jpg. This is the best format for continuous tone images for the web. They can be heavily compressed, while still retaining a lot of their detail. As noted before, there are two main things that determine file size – the number of pixels in the image and the compression applied when saving as a jpg. 'Export As' is designed to be used on images that are already resized, as it is primarily a compression tool, but even if you load a full size image into it, it will load anyway after warning you it wasn't designed to do so. You can then resize the image as well, but I prefer to resize the image first using the image size dialog and then compress for web using 'Export As'.

The basic compression choice comes in the form a slider that you set anywhere from 0 to 100. In the example above, it took a 410.7kb image and reduced it  to only 74.1kb at 50% quality. How much you compress is up to you, but I find the best balance for size and quality to be around the 50 mark. The compression will also depend on the amount of detail in the image (the more detail, the less redundancy is possible). Gif used to be the traditional format for graphics, like logos and such, as they support transparency and a smaller colour palette, but these days png is the default format for those type of files. Png files support transparency, which is very useful in web design, but pngs are a bit large, even out of the 'Export As' dialog. That said, there are ways to further reduce the size of pngs, including a great little online tool https://tinypng.com/ which compresses the png file while retaining transparancy. As a basic rule of thumb, use jpgs for photographs on the web and png for graphics. For a much more in-depth look at these formats, check out this excellent  article on sixrevisions.com

Colour Profiles

This is another huge area, and one that my interests have never taken me to. I'm very interested in digital asset management, but colour management: yawn…. I'll do my best to not make a fool of myself. In fact, to be safe, I will simply say that when saving images for the web, it is best to ensure they are saved with an sRGB colour profile, as this matches most closely the gamut of a monitor. Adobe RGB has a larger gamut, but images in this colour profile can look very flat and washed out on the web. Most cameras shooting jpgs are set to shoot in sRGB anyway, but if you are shooting RAW, you have to set the profile yourself when the data becomes an image. If you use Save for Web, you can get it to convert to sRGB when saving, which is probably the easiest way to go about it. It can also embed the colour profile as well, for those few browsers that actually check to see if an image has one.

Cropping & Aspect Ratios

This is a topic close to my heart. (OK, OK, I'm a nerd. Get over it). As I mentioned before, aspect ratio is inherent in the captured image, as it comes from the capture device. If you want a square image, you either have to shoot it with a 1:1 aspect ratio (Hasselblad anyone?) or you need to crop, which is totally different from resizing. Cropping is both resizing and changing the aspect ratio. Cropping is something to keep in mind when shooting. You might know you want a 1:1 shot, and so you compose a certain way in camera as if you were shooting with a 1:1 ratio. Or you can creatively crop after you have taken the image, finding new images in the image by selective cropping (as long as you have plenty of pixels to start with you won't lose too much quality unless you crop away most of the image, and particularly not if you're just going to web). Over the course of centuries, we have become used to certain aspect ratios in our two dimensional visual art. Many have their foundation in mathematics, or in that strange place where aesthetics and mathematics meet. The Golden Ratio is a good example of this (this is the "perfect" ratio). The beauty and simplicity of the square is of course another. Digital SLRs create images in a 3:2 ratio (close to the Golden Ratio but not exactly). TVs and computer monitors were commonly in the 4:3 ratio, as are most compact cameras and 16:9 is now a common wide screen ratio. The point of all this is that aspect ratios matter. When you crop, stick to an established aspect ratio than to just crop willy nilly. This is where some web designers, particularly WordPress template designers, could do a lot more work. Images in WordPress is another complex topic, as there are so many other things at play when dealing with templates and columns and forced resizing and WordPress image resizing etc, but personally I think it's best to stick to a bunch of established aspect ratios so that if you have to crop an image to re-purpose it, you always do it in a consistent manner.

Conclusion

OK, that's it. I hope you have learned a few things along the way. Thank you for reading. If you dispute anything, please bring it up in the comments. As long as you are reasonably polite, I will reply, and we might all learn something.