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.
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.
Table of Contents
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
- Read your image URLs, one per line, and your allowed domain(s).
- Encode each URL with a per-image random XOR key, and emit an
<img>tag plus a small shared decoder<script>that restores the realsrcafter the page loads. - Build the .htaccess rule: a
mod_rewriteblock 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. - Build the equivalent Nginx rule, using
valid_referersand anif ($invalid_referer)check inside alocationblock matched by file extension.
How Effective Is Each Layer
Understanding the Settings
| Setting | What 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 URL | Optional. 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 Extensions | Which 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 Referer | Some 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 Bots | Exempts 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?
Is this tool free?
Does obfuscating the image URL actually stop hotlinking?
What's the difference between the JS obfuscation and the .htaccess/Nginx rule?
Can the Referer header be faked, making this bypassable?
Why does the tool offer to allow requests with no Referer header?
Why allow search engine bots?
What does the placeholder/blocked image option do?
Do I need both the .htaccess and the Nginx snippet?
Will this break images already embedded on my own site?
Can I use this commercially?
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.