How to Protect Images on the Internet

A huge problem for people who want to display original images on the Internet is that anyone who can view the images can steal them. This page provides a few suggestions on how to protect your valuable images.

First of all, understand this: Any image which is displayed in a user's browser has already been downloaded by the user. There is simply no way to avoid this — it's how web pages work. Therefore the only way to be 100% safe is to not put your images on a web page. The suggestions on this page will deter some people and make you a little bit safer, but nothing will stop a user who knows what they are doing.

Hide Images from Search Engines

One of the biggest sources of image theft is search engines. Many search engines allow people to search for images, so if you can prevent the search engines from listing your image in the first place, you've plugged one hole already.

To do this, place all your images in one folder and use a robots.txt file to keep search engines out. This is a text file called robots.txt, placed in the root level of your website and including a reference to your images folder like this:

User-Agent: *
Disallow: /images/

Note that this is voluntary for search engines — it won't keep them all out but it will deter the main ones.

Disable Right-Click

This is a popular trick in which you disable right-clicking with JavaScript code. When the user right-clicks an image to save it, they get an error message telling them the action is not permitted. This works in most JavaScript-enabled browsers, but not all.

Disabling right-clicking is a well-known trick and will not deter anyone who knows how to deal with it. Also, because this method disables all right-clicking, it is very annoying for visitors who genuinely want to right-click in the page. A variation on the standard disbaler which only affects images can be found here.

On the whole, the drawbacks of this method outweigh the advantages and it is not recommended.


A lesser-known nifty trick is to cloak images behind a transparent gif. Place the original image on the page in a table or layer, then place a transparent GIF image the same size over the top. When users right-click the image they will save the transparent GIF and end up with nothing. Instructions can be found here.


This is a very safe method which protects the actual image, not just the way someone accesses it. Place a semi-transparent line of text (e.g. your business name or domain name) right through the middle of the image, rendering it useless for anyone else.

Obviously this method impacts the way the image looks, and is really only suitable for displaying sample images.