Hotlink Protection Generator & Tester

Stop other websites showing your images from your server. Generate the rule for Apache, nginx, Cloudflare, IIS or LiteSpeed, test that it works on a real image, and hide an invisible mark in a picture to prove it is yours.

Generator Web & Dev Updated Nov 30, 2026
Learn how this works
How to Use
  1. In Make the rule, type your domain, pick your server, and choose what other sites get instead of your image: a refusal (403) or a replacement picture.
  2. Leave search engines on so Google and Bing image results keep working, and keep Allow requests with no Referer on unless you know you need it off.
  3. Copy the rule and follow the steps under it. Behind Cloudflare or another CDN, use the Cloudflare rule rather than the server one.
  4. In Test an image, paste the address of one of your images. The tester fetches it as your own site, as another site and with no Referer, and says whether the rule works.
  5. In Mark an image, hide a short line of text (your site, a date) inside a picture. If a copy turns up somewhere, drop it back in to read the text out.
Input
Every site that may show your images, separated by commas. No https:// needed.
Presets
Who gets your image
Server
—
Sites allowed
—
File types
—
Other sites get
—

Worked Example

The rule doing its job. Your page https://example.com/gallery shows /photos/sunset.jpg. The browser asks for the file with Referer: https://example.com/. The host is on the allowed list, so the server answers 200 and the photo appears.

A forum at forum.example.net embeds the same file. Browsers send only the origin across sites by default, so the request carries Referer: https://forum.example.net/. That host is not allowed, so the answer is 403. The forum shows a broken image, or your replacement banner, and your server sends 0 bytes of the photo instead of 1.8 MB per view.

The common mistake. Turning off Allow requests with no Referer to be “stricter”. Someone opening https://example.com/photos/sunset.jpg in a new tab, someone whose privacy extension strips the Referer, and the bot that builds the Facebook or Slack preview for your post all send no Referer, and all of them now get 403. The forum still cannot hotlink either way; what changed is that real visitors broke.

What the tester reports. For a working rule: no Referer → 200 image/jpeg, your site → 200 image/jpeg, another site → 403 (or a 302 to /hotlink.png). If all three return the same 200 and the same bytes, the image is not protected.

Show Work

Make a rule, run a test or mark an image to see each step explained.

How the Rule Decides

1. Not an image?
serve as usual
Only the file types you list are checked. Pages, CSS and scripts are never touched.
2. No Referer?
allow (recommended)
Direct visits, privacy tools, apps and preview bots send none.
3. Referer on the list?
allow
Your domains, search engines, and any sites you added.
4. Anything else
403 or replacement
The replacement file itself is always exempt, or it would block itself.

How Hotlink Protection Works, and Where It Stops

When a browser loads an image for a page, it normally sends a Referer header naming the page that asked. (The misspelling is official: it was written that way in the HTTP/1.0 specification, RFC 1945, in 1996, and every standard since has kept it.) Hotlink protection is nothing more than a server rule that reads this header and refuses image requests that name somebody else's site.

Since Chrome 85 in 2020, followed by Firefox and Safari, browsers default to the strict-origin-when-cross-origin referrer policy, so a request from another site carries only that site's origin, such as https://forum.example.net/, never the full page address. That is enough for a hotlink rule, which only needs the host.

The limit is the same for every server and CDN: the Referer is chosen by the page that embeds the image. A site that adds referrerpolicy="no-referrer" to its image tags sends no Referer at all, and gets through any rule that allows an empty Referer, which a rule must do to avoid breaking real visitors. Hotlink protection reliably stops ordinary embedding, which is most of it. It is not a lock. Nothing that a browser can display can be kept from being saved; the invisible mark on this page is for the copies.

Caches are the other trap. A CDN that cached your image for one visitor serves the same answer to the next one without asking your server. If your site is behind Cloudflare or another CDN, put the rule in the CDN. The replacement-image rules here also send Cache-Control: private, no-store where the server allows it, so a cache never keeps the replacement and hands it to your own visitors.

About This Tool

This tool writes a hotlink rule for the five common setups (Apache, nginx, Cloudflare, IIS and LiteSpeed) from one set of choices, explains every line, then checks a real image from the outside and puts an invisible mark in a picture so you can identify copies.

The rule generator and the image marking run entirely in your browser; your images are never uploaded. The tester is the one part that uses our server: it fetches the image address you give it three times and reports the status codes, types and sizes. It does not keep the image.

It is for anyone with a site whose images are being embedded elsewhere: bloggers on shared hosting, photographers, shops and forum owners. For the rest of an Apache configuration, use the .htaccess generator.

Related tools: .htaccess Generator, CSP Generator, and Image Watermark.

Frequently Asked Questions

What is hotlinking?

Hotlinking is when another website shows your image by pointing an <img> tag straight at the file on your server. Their visitors see the picture, and your server pays for every download. A 2 MB photo on a page with 50,000 views costs you 100 GB of transfer.

Does hotlink protection stop people saving my images?

No. It only stops other websites displaying the file from your server. Anyone viewing your own page can still save the image or screenshot it, because their browser has already downloaded it. The invisible mark on this page is the answer to copies: it proves where a copy came from.

Why allow requests with no Referer?

Many real visitors send no Referer: people opening an image link directly, privacy browsers and extensions, many apps, and the bots that build link previews for Facebook, X, Slack and Discord. Blocking an empty Referer breaks all of them. The cost is that a site which sets referrerpolicy="no-referrer" can still hotlink, which is the known limit of every Referer rule.

Will hotlink protection hurt my SEO?

Not if search engines stay allowed. Google and Bing fetch images with their crawlers, which send no Referer, and image results pages link back with a google.* or bing.com Referer. This generator allows both by default.

I am behind Cloudflare. Which rule should I use?

The Cloudflare one. A CDN caches your image and serves it without asking your server, so a rule on your server is often never reached. Cloudflare's built-in Hotlink Protection switch covers GIF, ICO, JPG and PNG. For WebP, AVIF or SVG, or to allow search engines and other sites, use the custom rule this page writes.

How do I use the Hotlink Protection Generator & Tester?

Simply pick your options and read the result, which refreshes the instant you change something. There is nothing to submit and nothing to wait for.

Does it cost anything or need an account?

No. The tool is completely free, there is no account to create, and it keeps working offline after the page first loads.

Is anything I type uploaded?

No. The tool works entirely on your device, so the values you enter never leave your browser.

Common Use Cases

A photo going viral on a forum

A 1.8 MB photo embedded in a thread with 40,000 views is 72 GB of your bandwidth. With the rule in place the forum shows a 403 or your replacement banner, and your page still works.

Shared hosting with a transfer cap

On a 100 GB/month plan, three hotlinked wallpapers can use the whole allowance. The Apache rule takes one .htaccess file and no server access.

Checking a rule you already have

Paste one image URL into the tester. Your own site should get 200, another site should get 403 or a different image, and no Referer should get 200.

Proving a copied picture is yours

Mark the original with "© example.com 2026" before publishing. A copy that was re-saved as JPEG, scaled to half size or cropped can still be read back.

Moving from Apache to nginx

nginx ignores .htaccess, so an old Apache hotlink rule silently stops working after a move. Generate the nginx version with the same domains and test it.

Last updated: