On This Page
Uploading images to your website without thinking ahead is never a good idea. If images are not properly optimized, it can affect your entire website’s performance. The following recommendations are going to reduce your sites load speed, allow site visitors get more out of your images and help search engines understand your images as well as index them.
In order to explain this easily, I am going to use an example. Let’s say we run a baking website and we want to add a new photo of our newly tested recipe of lemon cranberry scones.
The image file name is important because it helps tell search engines what your image is about. Usually, when you upload an image the file name can be quite undescriptive, to say the least. For example: IMG022715.jpg. Can you tell what this image is from reading the file name? Hopefully not. Otherwise, you may need to see a doctor. Now take a look at lemon-cranberry-scones.jpg. Can you tell what this image is just from reading the file name? A short but descriptive file name can help users and search engines.
If you need to update image file names in bulk, follow this guide.
Alt text can provide additional details about an image for both users and search engines. Alt text is used in two ways. If for some reason the image cannot be displayed, the alt text will show instead, giving users an idea of what the image is. See the example below.
<img src="/wp-content/uploads/ac-repair-tampa.jpg" alt="ac repairman fixes broken air conditioner in tampa florida">
More importantly, alt text is used by search engines. Search engines claim that they cannot read images and that they use alt text to try to understand what images are about.
See this guide on how to add alt text in bulk.
Alt text shouldn’t be extremely long. There are no official alt text length recommendations but I have read different recommendations of 50, 100, 125 and 140 characters. So just a simple, clear explanation of the image is good. For example, “freshly baked lemon cranberry scones”.
The title text provides another opportunity to tell search engines and people what your image is about but it seems a bit overkill. I don’t really use the title attribute. The title won’t help improve your rankings but it can be useful to people. If you decide to use title text don’t just copy the alt text, make it different.
You can add a caption to images. This will usually be displayed below the image. Sometimes people don’t read an entire article, they may just scan the images and headlines. The captions will make your images stand out to users but once again, search engines can read this text to find out more about your images.
Once you have chosen the image that you want to use on your website, you need to make sure it’s not unnecessarily large. Some larger images like a background or high-quality images of a photographers portfolio are obviously going to be larger in size when compared with a simple logo or an icon.
If the image you are going to upload is 600 x 400 pixels but you are going to display it at 220 x 100 pixels then you should resize it before you upload it. You can upload it as 600 x 400px and then resize it by using HTML height and width attributes but this is not recommended because you will be using more bandwidth thus slowing down your site.
Once you have resized the image using an image editing tool, you should compress the image to reduce it’s size even further. There are many tools out there but I have used CompressJPG and CompressPNG.
Important: Keep in mind that compressing images will reduce their quality. You will need to test out different compression levels on different images. For example, I may have one image that I compress and reduce by 40% without it starting to look crappy. Another photo may only be able to be reduced by 10% before it starts to look bad. You will have to figure out which one is best for each image on a case-by-case basis.
But what if you have many photos on a website already? How can you compress all of them in bulk? Well, if it’s a WordPress site there is a great plugin called ShortPixel that will compress all the images in your WordPress media folder and then replace all of the uncompressed images with compressed versions. It’s super easy! Plus, it will keep a copy of the original images in case you want to restore an image back to the uncompressed version.
Search engines examine entire pages, not just images. They take into account the content around the images to learn even more about your images. If your page is talking about NBA highlights but you have an image of lemon cranberry scones in one of the paragraphs, search engines will find this confusing. Always add your images near related content.
XML sitemaps help search engines, specifically Google and Bing, find all the pages on your website. Some pages may not be linked to so when a search engine crawls your site, they would never find that page.
You can create an XML Image Sitemap or if you use WordPress you can use Yoast’s SEO Plugin to get your attachments into your sitemap.
In WordPress, when you upload an image WordPress makes a post of the attachment (or image) and creates an entire page for it with its own URL. This is known as the media post type.
For example, this image:
also has a media post of it that WordPress created here:
Yoast suggests possibly not including the media post type in your sitemap. This won’t stop Google from indexing your images. Since Yoast automatically enriches your XML sitemap with your images, they will show up in Webmaster tools.
- File Name: Someone should be able to tell what the image is about just from reading the file name.
- Alt Text: This should complement the file name. Someone should be able to tell what the image is about just from reading the file name.
- Title: Somewhat redundant but you can use the title attribute to give more info about your image if you like.
*File name, alt text and title should not be the same but should complement each other.
- Caption: Captions are optional but can help images stand out more to users and provide more info. for the search engines.
- File Size: Resize images then compress them before uploading them to your website.
- Nearby Content: Place images on pages and/or paragraphs with relevant content.
- Images in Sitemap: Add an image sitemap. If you use WordPress, use Yoast’s SEO plugin.
So what are you waiting for? Get to optimizing your images!