I'm looking for an URL that goes directly to the first Google hit from a certain domain as in "I'm Feeling Lucky" but limited to a certain domain.

I'm using this formula, but it typically doesn't work.


Edit: It seems to work a lot of the time actually. However, there are quite a few cases in which it will not work.

6 Answers 6


Use links like https://www.google.com/search?btnI=1&q=%s site:developer.mozilla.org

btnI=1 makes the difference from a normal request.


I solved this by switching to an equivalent service by another search engine.

While the formula given in the question often works, Google will sometimes chicken out and go to a regular search results page rather than going directly to the top hit.

DuckDuckGo never chickens out. It always goes to the top hit.

Therefore I am using DuckDuckGo for this particular service from now on.

Here is the formula for DuckDuckGo:


For example:


This is where I learned it, by the way.

  • This doesn't work as a link from an external site.
    – Semra
    Commented Apr 5, 2023 at 12:44

In my experience, using an ordinary "btnI=1&q=" Google URL worked fine in the past. But for a few years I've been experiencing unreliable "lucky" redirects, as noticed by the poster of this question. After some troubleshooting I discovered that one can fix this with a "Referer: http://www.google.com/" header:

w3m -header "Referer: http://www.google.com/" "http://www.google.com/search?ie=ISO-8859-1&hl=en&source=hp&q=happy+nation+lyrics&btnI=I%27m+Feeling+Lucky&gbv=1"

For me, removing the header parameter in the above command causes the redirect not to work. Redirect also breaks if you remove the "www." in the "http://" URL.

I figured this out by comparing the URLs and headers in the HTTP requests generated by manually clicking on the "Lucky" button vs loading the URL directly. https://serverfault.com/questions/504431/human-readable-format-for-http-headers-with-tcpdump (Unfortunately this snooping method only works with HTTP, not HTTPS)

  • As of October 2019, "Google lucky" URLs sometimes produce a special redirect page, for me at least, that needs extra parsing to get the URL of the top result. I just wrote a script which does this, but it is not very elegant. Commented Dec 10, 2019 at 4:16

In our monitoring platform, we rely on such "lucky" URLs mainly for the identification of disk drive models by their product number e.g. KCD8XPUG3T84

While the suggested answers worked well in the past, in 2024 even the DuckDuckGo solution is not behaving as expected.

Hence we've built: https://lucky.surf/ initially for our internal use, but we're opening it up for the world as of today.

How to use it? One way would be to, simply append your search parameter in the URI eg.

Disclaimer: lucky.surf is a product developed by us, and it is directly affiliated with BlackHOST

  • If you want to recommend your own product or website, there are some guidelines in place for doing so. Following them will help you avoid giving the impression that you're spamming. Please edit your post to explicitly state your affiliation. (If you're not actually affiliated, it may be worth mentioning that as well.) Commented Feb 29 at 14:38

Use this one (Twitter as example, you change this to your search words)


To stop the redirect notice use this small extension.


Try this one.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.