Images Not Loading on Your Website? Here Are 6 Possible Reasons Why

6 Reasons Why Your Website May Be Showing Broken Images

Road sign saying
Missing images make your site look broken.

The old saying goes that "a picture is worth a thousand words." This is especially true on the Web, where attention spans are notoriously short and so the right image can really make or break a site by attracting the right attention and engaging page visitors long enough for them to learn what they need to learn or perform a specific action that signals a "win" for the site. Yes, when it comes to website, images may actually be worth more than a thousand words!

So with the importance of online images established, let's next consider what is your website saying if an image that is supposed to be on the site fails to load? This can happen whether you have inline images that are part of the HTML or background images applied with CSS (and your site likely has both of these). The bottom line is that when a graphic fails to load on a page, it makes the design look broken and, in some cases, can completely destroy the user experience on that site. The "thousand words" that the picture is sending are certainly not positive ones!

Let’s take a look at some of the common reasons why images would fail to load on a site, as well as what you should be mindful of when troubleshooting this problem during website testing.

1. Incorrect File Paths

When you add images to a site’s HTML or CSS file, you must create a path to the location in your directory structure where those files reside.

This is code that tells the browser where to look for and fetch the image from. In most cases, this would be inside of a folder named ‘images.’ If the path to this folder and the files inside of it are incorrect, the images will not load properly because the browser will not be able to retrieve the correct files.

It will follow the path that you told it to, but it will hit a dead end and, instead of display the appropriate image, will come up blank.

Step 1 in debugging image loading issues is to make sure that the file path you have coded is correct. Perhaps you specified the wrong directory or did not correctly list the path to that directory.  If these are not the case, you may have another issue with that path. Read on!

2. Files Names Misspelled

As you examine the file paths for your files, also be sure that you spelled the name of the image correctly. In my experience, incorrect names or misspellings are the most common cause of image loading issues. Remember, web browsers are very unforgiving when it comes to file names.  If you forget a letter by mistake or use the wrong letter, the browser will not look for a file that is similar and say, "oh, you probably meant this one, right?"  No - if the file is spelled wrong, even if it is close, it will not load on the page.

3. Wrong File Extension

In some cases, you may have the name of the file correctly spelled, but the file extension may be incorrect. If your image is a .jpg file, but your HTML is looking for a .png, there will be a problem. Make sure you are using the correct file type for each image and then be sure you have called for that same extension in your website’s code.

 Also look for case sensitivity.  If your file ends with .JPG, with the letters all in caps, but your code references .jpg, all lowercase, there are certain web servers who will see those two are different, even though they are the same sets of letters.  Case sensitivity counts!  This is why I always save my files with all lowercase letters.  Doing so allows me to always use lowercase in my code, eliminating one possible problem I could have in my image files.

4. Files Are Missing

If the paths to your image files are correct, and the name and file extension are also error free, the next item to check is to make sure that the files have actually been uploaded to the web server. Neglecting to upload files to that server when a site is launched is a common mistake that is easy to overlook. How do you fix this problem?

Upload those images, refresh your web page, and it should immediately display the files as expected.  You can also try to delete the image on the server and reupload it.  It may seem strange, but I have seen this work more than once.  Sometimes files get corrupted, so this "delete and replace" method can end up helping.

5. The Website Hosting the Images Is Down

You will typically want to host any images that your site uses on your own server, but in some cases you may be using images that are hosted elsewhere. If that site hosting the image goes down, your images are not going to load either.

6. Transfer Problem

Whether an image file is loaded from an external domain or from your own, there is always a chance that there may be a transfer problem for that file when it is first requested by the browser. This should not be a common occurrence (if it is, you may need to look for a new hosting provider), but it can happen from time to time.

The unfortunate side of this issue is that there really is nothing you can do about it since it is a problem outside of your control. They good news is that it is a temporary problem that is often resolved pretty quickly. For instance, when someone sees a broken-looking page and refreshes it, that alone will often fix the problem and properly load the images.If you are seeing a broken image, refresh the browser to see if perhaps it was just a transmission issue on your initial request.

A Few Final Notes

When thinking about images and loading concerns, two things to also be mindful of are the proper use of ALT tags and the your website speed and overall performance.

ALT, or “alternate text”, tags are what is displayed by a browser if an image fails to load. They are also an important component in creating accessible websites that can be used by people with certain disabilities. Every inline image in your site should have an appropriate ALT tag. Note that images applied with CSS do not have this attribute.

As for website performance - loading too many images, or even just a few giants images that are not properly optimized for web delivery, will have a negative impact on loading speed.

For this reason, be sure to test the impact of any images that you use in your site’s design and take any steps that are necessary to improve that site’s performance while still creating the overall look and feel that is appropriate for your website project.

Edited by Jeremy Girard on 4/5/17