About  |  Contact Us  
GoogleGuide logo

Linking to Search Results

If you know HTML, it’s relatively easy to make links to Google’s search results. Following each link in the examples below is the code that produces it.

See search results in the same browser window

Google tutorial create link ]

is generated from

[&nbsp;<a href=”https://www.google.com/search?q=Google+tutorial+create+link”>Google tutorial create link</a>&nbsp;]

See search results in a new window

Open a new window containing the search results for the query

Google tutorial create link ]

by adding target="_blank":

[&nbsp;<a target=”_blank” href=”https://www.google.com/search?q=Google+tutorial+create+link”>Google tutorial create link</a>&nbsp;]

Search link must be valid

The URL — that is, the text shown in Italics here: href="https://URL-GOES-HERE” — must be valid. For instance:

  • The URL shouldn’t contain any spaces. Use a plus sign (+) in place of each space.
  • Certain characters can’t be used literally; they must be encoded into a form like %nn.

For example, the query [ “a song for you” ] would be encoded in a URL as https://www.google.com/search?q=%22a+song+for+you%22, where each quote (") is replaced by %22.

The easiest way to find the correct encoding is to type your query into a Google Search box. Then run the search and look at the resulting URL in your web browser’s address box (which is usually in the toolbar at the top of the window). Copy and paste the parts you need from the URL into your HTML code.

AdSense for Search

With AdSense for Search, you can easily create a revenue stream at the same time as provide a Google search box like the following.


Fill the search box with a query by specifying a value the attribute “value”, which AdSense for Search initializes to the null string (”").

Google search box with [ Google ~Guide ].

Note: If you fill the search box with a query, Google may not share revenue with you.

AdSense for WebSearch + SiteSearch

AdSense for WebSearch + SiteSearch allows users to search the web or the specific site(s) of your choice.

Web www.googleguide.com

Note: AdSense for Search centers the search box on the page while AdSense for WebSearch+SiteSearch doesn’t. Of course, you can modify the AdSense code to place the search box wherever you want on the page.


These problems are intended to give you practice in creating links to Google’s search results.

  1. On one of your web pages, create a link to a Google search result.
  2. On one of your web pages, create a link that opens a new window and displays a Google search result.
  3. Use AdSense for Search to create a Google search box on a page in your website. You’ll need to sign up for an AdSense account first.
  4. On one of your web pages, using AdSense for WebSearch + SiteSearch, create a Google search box with a radio button for searching your site. Get an AdSense account before doing this problem.

tags (keywords): , ,

This page was last modified on: Tuesday March 13, 2007

For Google tips, tricks, & how Google works, visit Google Guide at www.GoogleGuide.com. Google Guide is neither affiliated with nor endorsed by Google.

Creative Commons

By Nancy Blachman and Jerry Peek who aren't Google employees. For permission to copy & create derivative works, visit Google Guide's Creative Commons License webpage.