Losing clicks to competitors? Find out exactly why, and what to fix first.

Show me why
Skip to content

Technical SEO

How to Block Images From Google With Robots.txt

Add saadrazaseo.com as a preferred source on Google

No pressure and no sales script. Just honest answers.

To keep images out of Google Images, add a rule for the Googlebot-Image user agent that disallows the folder or file. This stops that crawler fetching those images, but it does not hide them from people who have the direct link and it does not instantly remove images that are already indexed.

The rule

User-agent: Googlebot-Image
Disallow: /private-images/

This blocks the Google Images crawler from that folder only. To block every image on the site, use Disallow: / under the same user agent, though that is rarely what a business wants.

Block one file type

User-agent: Googlebot-Image
Disallow: /*.gif$

The pattern uses the wildcard rules explained in robots.txt wildcards.

Not sure if this is hurting your site?

Get the fixes that matter most, in priority order.

Find my blockers

What this does not do

  • It does not password-protect the files.
  • It does not stop other crawlers unless you add rules for them.
  • It does not remove images already in the index quickly. Use the removals tool or return an error status for urgent cases.

Be careful about blocking useful images

Images help pages rank for image search and help Google understand content. Blocking product or portfolio photos by accident can reduce visibility. If you want images found, follow image SEO best practices instead.

Test the rule

Write the rule with the robots.txt generator, then check a sample image URL in the robots.txt tester.

Frequently asked questions

Will blocking images hurt my page rankings?

It can reduce image search traffic and give Google less context about the page, so block only what you truly need to.

Can I allow one image inside a blocked folder?

Yes. Add a more specific Allow rule for that file.

Next steps

If you need to protect images properly, restrict access on the server. For a review, contact me here.

More in this series (robots.txt testing questions): start with Robots.txt Tester and AI Crawler Checker, then explore:

Is this holding your site back?

Share your website and I will look at the technical issues holding it back.

Your details are only used to reply to your request. No spam.

Grow my trafficCall