Menu

Image URL Obfuscator

Stop other sites from hotlinking your images. Hides your image URLs behind a JS runtime decoder, and generates ready-to-use .htaccess and Nginx referer-based hotlink-block rules — with an allowlist for your own domains and search-engine bots. Everything runs locally in your browser.

Hotlink Protection Studio Free
Ready
Image URLs (one per line) 0 lines • 0 chars
Generated Protection Code 0 chars generated
Protection Settings
All processing runs in your browser. Your image URLs and domains are never uploaded. The .htaccess/Nginx rule is what actually stops hotlinking — the JS obfuscation is a lighter extra layer. Always test on a staging copy before deploying to production.
Complete Guide to Stopping Image Hotlinking

Hotlinking is when another website's page embeds an <img> tag that points straight at an image on your server, instead of copying the file to their own hosting. Every visitor who opens their page downloads the image from your server — using your bandwidth, your CPU, and sometimes pushing you over a hosting quota, all for traffic you don't benefit from.

This tool gives you two layers of defense: a lighter client-side obfuscation that hides the real URL from anyone skimming your page's HTML, and a server-side referer check (.htaccess or Nginx) that actually refuses the image request unless it came from a domain you allow. The second layer is the one that really stops hotlinking; the first raises the effort needed to grab a usable URL in the first place.

What Is Hotlinking, and Why It Matters

Browsers fetch an <img src> from wherever it points, regardless of which page is showing it. If a forum post, a marketplace listing, or a scraped "news" site embeds a direct link to an image on your server, your server pays the bandwidth cost of serving it to every one of their visitors — with none of the traffic, credit, or ad revenue coming back to you.

Beyond bandwidth, hotlinking can also mean someone is reusing your product photos, graphics, or diagrams without permission, sometimes at a scale that genuinely affects your hosting bill or CDN costs.

The Two Layers This Tool Generates

JS-Obfuscated <img> Tags

Each image URL is encoded as hex bytes XORed with a fresh random key, stored in a data-csimg attribute instead of a normal src. A small decoder script runs once the page loads, decodes the attribute, and sets the real src. Anyone who right-clicks "Copy Image Address" before the script runs, or scrapes your raw HTML looking for image URLs, sees only the encoded string.

Referer-Based Server Block (.htaccess / Nginx)

Every image request carries an HTTP Referer header identifying which page asked for it (when one is sent at all). The generated rule checks that header against your allowed domain list and refuses (or redirects) any request whose referer isn't yours — this works regardless of how the hotlinker obtained the URL, including from a cached or previously-copied link.

How the Tool Works

  1. Read your image URLs, one per line, and your allowed domain(s).
  2. Encode each URL with a per-image random XOR key, and emit an <img> tag plus a small shared decoder <script> that restores the real src after the page loads.
  3. Build the .htaccess rule: a mod_rewrite block that allows your domain(s) (and, optionally, empty referers and known search/social bots), and blocks or redirects everything else, scoped to your chosen image file extensions.
  4. Build the equivalent Nginx rule, using valid_referers and an if ($invalid_referer) check inside a location block matched by file extension.

How Effective Is Each Layer

Be realistic about what each layer stops. JS obfuscation alone stops a person copy-pasting an image address out of your HTML — it does nothing against a script that fetches the page, runs no JavaScript, and looks for the pattern elsewhere, and nothing once the decoded URL is live in the rendered DOM (view-source after load, or DevTools, still show it). The referer-based server rule is what actually blocks the request at your server regardless of how the URL was obtained, and is the layer to rely on for real protection. Referer headers can also be spoofed by a determined script, so treat this as a strong deterrent against the overwhelming majority of real-world hotlinking, not an unbreakable guarantee.

Understanding the Settings

SettingWhat it does
Allowed Domain(s)Your own domain(s) - these are exempted from the block, so your site keeps displaying its own images normally. Add every domain and subdomain your pages are actually served from.
Placeholder/Blocked Image URLOptional. If set, a blocked request is redirected to this image instead of getting a plain 403 - useful for showing a "hosted elsewhere" graphic to the hotlinking site's visitors.
Image ExtensionsWhich file types the server rule applies to. Defaults to the common web image formats; narrow it if you only want to protect specific types.
Allow Empty RefererSome browsers, privacy tools, RSS readers, and direct address-bar visits send no Referer header at all. Leaving this on (recommended) avoids blocking those legitimate cases.
Allow Search Engine BotsExempts known crawler user agents (Googlebot, Bingbot, social link-preview bots) so your images stay indexable and link previews keep working.

Use Cases

E-commerce Product Photos

Stop competitor listings or marketplace scrapers from embedding your product images directly from your CDN.

News, Blog & Portfolio Sites

Protect original photography, infographics, and illustrations from being re-embedded by content-scraping sites.

Forums & Community Sites

Stop other forums or image boards from hotlinking uploads straight from your attachment storage.

Bandwidth-Sensitive Hosting

Cut unexpected bandwidth or CDN bills caused by a page elsewhere unexpectedly going viral while linking your images directly.

Limitations & Legal

  • Referer checks can be spoofed. A script controlling its own request can fake or omit the referer header. Treat this as a strong, practical deterrent, not a cryptographic guarantee.
  • JS obfuscation requires JavaScript. It won't work as a plain <img src> in contexts without JS (some email clients, RSS feed readers, or scrapers that only read raw HTML) - which is also, incidentally, exactly what makes it a hotlinking deterrent for those same scrapers.
  • List every domain you actually use. Forgetting a subdomain (or an alternate domain your own site is served from) will cause the server rule to block your own images there too.
  • .htaccess needs Apache + mod_rewrite; the Nginx snippet needs an Nginx server block. Use whichever matches your hosting - not both at once unless you understand your stack.
  • Legal. Only protect images you own or have the rights to control. This tool generates defensive configuration, not a takedown or enforcement mechanism.

Related Tools

Frequently Asked Questions

What is image hotlinking?
Hotlinking is when another website embeds an <img> tag that points directly at an image hosted on your server, instead of copying the file to their own hosting. Every visitor who loads their page also downloads the image from your server, using your bandwidth and server resources for someone else's content.
Is this tool free?
Yes, completely free with no registration or limits. All processing happens in your browser - nothing is uploaded to a server.
Does obfuscating the image URL actually stop hotlinking?
On its own, URL obfuscation only stops the simplest form of hotlinking: someone copying an image address straight out of your page's HTML. It does not stop a server-side scraper that can still find and fetch the real URL another way, and it does not stop a referer-blocking check at your web server. For real protection, pair it with the generated .htaccess or Nginx rule, which blocks the request at the server based on where it came from, regardless of how the URL was obtained.
What's the difference between the JS obfuscation and the .htaccess/Nginx rule?
The JS-obfuscated <img> tags hide the real URL from anyone casually viewing your page's source, so simple copy-paste hotlinking shows a meaningless string instead of a usable link. The .htaccess/Nginx rule is server-side: it checks the HTTP Referer header on every image request and refuses (or redirects) any request that didn't come from your allowed domain(s), which is the actual mechanism that stops bandwidth theft, regardless of how the hotlinker got the URL.
Can the Referer header be faked, making this bypassable?
Yes. The Referer header is sent by the browser and can be spoofed by a script or a determined user, so referer-based blocking is a strong deterrent against casual hotlinking rather than an absolute guarantee. It stops the overwhelming majority of real-world hotlinking (other websites embedding your images in normal <img> tags), which is what this tool is built for.
Why does the tool offer to allow requests with no Referer header?
Some browsers, privacy extensions, RSS readers, and direct address-bar visits don't send a Referer header at all. Blocking every request with an empty referer would also block some of your own legitimate visitors. Allowing empty referers is the commonly recommended default; you can disable it for stricter protection if you understand the trade-off.
Why allow search engine bots?
Search engine and social-media crawlers (Googlebot, Bingbot, Facebook's link-preview bot, and similar) fetch your images directly, without a normal browser Referer header, to index them for Google Images or to generate link previews. If your hotlink protection blocks them, your images can disappear from image search results or stop showing up in shared-link previews. The bot allowlist exempts known crawler user agents from the block.
What does the placeholder/blocked image option do?
If you leave it blank, a blocked hotlink request gets an HTTP 403 Forbidden response (a broken image icon on the hotlinking site). If you provide a URL, the rule redirects blocked requests to that image instead - commonly used to show a branded 'this image is hosted elsewhere' graphic, which also makes it obvious to the hotlinking site's visitors (and owner) what happened.
Do I need both the .htaccess and the Nginx snippet?
No - use whichever matches your web server. .htaccess rules only work on Apache (or Apache-compatible setups like most shared/cPanel hosting) with mod_rewrite enabled. The Nginx snippet is the equivalent for servers running Nginx, added inside a server block rather than a .htaccess file. If you're not sure which you have, check with your hosting provider.
Will this break images already embedded on my own site?
The server-side rule only blocks requests whose referer doesn't match a domain you listed - so make sure you include every domain (and subdomain) your own site actually serves pages from. The JS-obfuscated <img> tags need their decoder script to run, so they require JavaScript to be enabled in the visitor's browser; they are not a drop-in replacement for a normal <img src> if you need the image to work with JavaScript disabled or inside an RSS feed/email.
Can I use this commercially?
Yes. The generated code is yours to use on any site, commercial or personal, with no attribution required.

Conclusion

Real hotlink protection comes from the server-side referer rule; the JS obfuscation is a useful extra layer that raises the effort needed for casual copy-paste hotlinking. Use both together, keep your allowed-domains list complete, and remember to keep search engine bots allowlisted so your own SEO and link previews don't suffer.