Hacking Google URLs

Hacking the URL Google hands you in response to a search.

When you think of hacks you might think of making a cool search form or performing a particularly intricate search. But you can also hack search results by hacking the URL that Google returns after a search. There’s at least one thing you can do by hacking the URL that you can do no other way, and there are quick tricks you can do that might save you a trip back to the advanced preferences page otherwise.

Anatomy of a URL

Say you want to search for three blind mice. Your result URL will vary depending on the preferences you’ve set, but the results URL will look something like this:


The query itself—&q=%22three+blind+mice%22, %22 being a URL-encoded " (double quote)—is pretty obvious, but let’s break down what those extra bits mean.

num=100 refers to the number of search results to a page, 100 in this case. Google accepts any number from 1 to 100. Altering the value of num is a nice shortcut to altering the preferred size of your result set without having to meander over to the Advanced Search page and rerun your search.

Don’t see the num= in your query? Simply append it to your query URL using any value between 1 and 100.


You can add or alter any of the modifiers described here by simply appending them to the URL or changing their values—the part after the = (equals)—to something within the accepted range for the modifier in question.

hl=en means the language interface—the language in which you use Google, reflected in the home page, messages, and buttons—is in English (at least mine is). Google’s Language Tools page [Hack #2] provides a list of language choices. Run your mouse over each and notice the change reflected in the URL; the one for Pig Latin looks like this:


The language code is the bit between intl/ and the last /, xx-piglatin in this case. Apply that to the search URL at hand:


What if you put multiple &hl modifiers on a result URL? Google uses whichever one comes last. While it makes for confusing URLs, this means you can always resort to laziness and add an extra modifier at the end rather than editing what’s already there.

There are a couple more modifiers that, appended to your URL, may provide some useful modifications of your results:


Specifies the maximum age of the search results, in months. x is any number between 1 and 12; I find that numbers between 1 and 6 are best.


Means the SafeSearch filter is off. The SafeSearch filter removes search results mostly of a sexually explicit nature. safe=on means the SafeSearch filter is on.

Hacking Google’s URL may not seem like the most intuitive way to get results quickly, but it’s much faster than reloading the advanced search form and in one case (the “months old” modifier) it’s the only way to get at a particular set of results.

Get Google Hacks now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.