Google Query Syntax Reference

[edit]

Default Search

By default, Google only returns pages that include all of your search terms. There is no need to include "AND" between terms. Keep in mind that the order in which the terms are typed will affect the search results.  To restrict a search further, just include more terms.

Google ignores common words and characters such as "where" and "how", as well as certain single digits and single letters, because they tend to slow down your search without improving the results. Google will indicate if a common word has been excluded by including text in the search comments field of the search results returned.

Special Characters

By default, all non-alphanumeric characters that are included in a search query are treated as query term separators (just like space characters).  

The only exceptions to this rule are the following characters: double quote mark ("), plus sign (+), minus sign (hyphen) (-) and ampersand (&).  The ampersand character (&) is treated as another character in the query term in which it is included, while the remaining exception characters correspond to search features listed in the section below.

Special Query Terms

Google supports the use of several special query terms that allow the user or search administrator to access additional capabilities of the Google search engine.  These special query terms are listed below.

Note: All query terms must be correctly URL-encoded in the search request sent to Google search.

Special Query Capability
Sample Usage
Description
Basic Operators
Include Query Term star wars episode +I

If a common word is essential to getting the results you want, you can include it by putting a "+" sign in front of it.  The one exception to this is "the", which is so common it is not considered in any searches.

Exclude Query Term bass -music Sometimes what you're searching for has more than one meaning.  For example, the term "bass" can refer to either fishing or music. You can exclude a word from your search by putting a minus sign ("-") immediately in front of the term you want to exclude from the search results.
Include Query Term and Its Synonyms html ~tutorial You can include a word and its synonyms in your search by putting a tilda ("~") immediately in front of the term.
Phrase Search "john quincy adams"

john/quincy/adams

john-quincy-adams

john-*-adams

Search for complete phrases by enclosing them in quotation marks or connecting them with slashes or hyphens. Words marked in this way will appear together in all results exactly as you have entered them. Phrase searches are especially useful when searching for famous sayings or proper names.

Note: Note a "*" may be used as a wildcard within a phrase.

Note: You may need to use a "+" to force inclusion of common words in a phrase.

Boolean OR Search vacation aruba OR barbados Google search supports the Boolean "OR" operator. To retrieve pages that include either word A or word B, use an uppercase OR between terms.
Query Modifiers
NOTE: Most of the below query modifiers can be negated by immediately preceding the modifier with a "-", Google's exclusion operator.
Host or Domain Restricted Search site:www.w3c.org xml

site:ibm.com xml

-site:whitehouse.com bush

site:oocities.com inurl:oocities.com/ian_springer

Search only within a specific host or domain. Do this by entering your query followed by the string "site:" followed by a host or domain name.
Title Search (term) intitle:wsdl uddi If you prepend "intitle:" to a query term, Google search will restrict the results to documents containing that word in the title.  Note there can be no space between the "intitle:" and the following word.

Note: Putting "intitle:" in front of every word in your query is equivalent to putting "allintitle:" at the front of your query.

Title Search (all) allintitle: wsdl uddi If you start a query with the term, "allintitle:"; Google search will restrict the results to those with all of the query words in the title.
URL Search (term) inurl:wsdl uddi If you prepend "inurl:" to a query term, Google search will restrict the results to documents containing that word in the result URL.  Note there can be no space between the "inurl:" and the following word.

Note:  "inurl:" works only on words, not URL components.  In particular, it ignores punctuation and will only use the first word following the "inurl:" operator.  To find multiple words in a result URL, use the "inurl:" operator for each word.

Note: Putting "inurl:" in front of every word in your query is equivalent to putting "allinurl:" at the front of your query.

URL Search (all) allinurl: wsdl uddi If you start a query with the term, "allinurl:"; Google will restrict the results to those with all of the query words in the result URL.

Note: "allinurl:" works only on words, not URL components. In particular, it ignores punctuation.  Thus, "allinurl: foo/bar" will restrict the results to page with the words "foo" and "bar" in the url, but won't require that they be separated by a slash within that url, that they be adjacent, or that they be in that particular word order. There is currently no way to enforce these constraints.

Text Only Search (term) intext:digital If you start a query with the term, "intext:"; Google will restrict the results to those with the specified word in the body text only, ignoring link, URL and title matches. Note there can be no space between "intext::" and the specified word.
Text Only Search (all) allintext: wsdl uddi If you start a query with the term, "allintext:"; Google will restrict the results to those with all of the query words in the body text only, ignoring link, URL and title matches.
Anchors Only Search (term) inanchor:digital If you start a query with the term, "inanchor:"; Google will restrict the results to those with the specified word in the links only, ignoring text, URL and title matches. Note there can be no space between "inanchor::" and the specified word.
Anchors Only Search (all) allinanchors: wsdl uddi If you start a query with the term, "allinanchors:"; Google will restrict the results to those with all of the query words in the links only, ignoring text, URL and title matches.
Links Only Search (all) allinlinks: wsdl uddi If you start a query with the term "allinlinks:"; Google will restrict the results to those with all of the query words in the URL links on the page.
File Extension Filtering filetype:htm OR filetype:html nasa

ext:pdf OR ext:doc nanotechnology

The query prefix, "filetype:", will filter the results returned to only include documents with the extension specified immediately after.  Note there can be no space between "filetype:" and the specified extension.

Note: Multiple extensions can be included in a filtered search by adding more "filetype:" terms to the search query.

Note: For a list of file types that are indexed by Google, see the Google file types FAQ.

Date Range Filtering daterange:2452122-2452234 star wars The query prefix, "daterange:", will filter the results to include only documents that were published in the Google database within the specified Julian date range. The Julian date is calculated by the number of days since January 1, 4713 BC. For example, the Julian date for August 1, 2001 is 2452122. Use a Julian date converter to convert conventional dates to Julian dates. Note there can be no space between "-daterange:" and the specified date range.
Google Groups Query Modifiers
Search Specific Group(s) group:comp.sys.hp.hpux 11.22

group:comp.* termcap terminfo

The query prefix, "group:" will search only the specified newsgroup(s) for the search term(s). Multiple newsgroups may be specified using wildcards at the end of the group name. However, no more than one group modifier may be used in a query. Note there can be no space between "group:" and the specified newsgroup(s).
In-Subject Filtering insubject:tolkien

group:comp.unix.* insubject:syslog

The query prefix, "insubject:" will only include results that have the specified word in the subject of the post. Note there can be no space between "insubject:" and the specified word.
Author Filtering author:ian_springer@hp.com

author:springer,ian

The query prefix, "author:" will only include results that have the specified email address or name as the author of the post. Note there can be no space between "author:" and the specified email address or name.
Message ID Filtering msgid:<7nne01$5a7$1@shell15.ba.best.com>#1/1 The query prefix, "msgid:" will return the post with the specified message ID. Note there can be no space between "msgid:" and the specified ID.
Alternate Query Types
Back Links link:www.faqs.org/faqs/hp/hpux-faq/ The query prefix, "link:", will list referring pages (pages that have links to the specified URL).  Note there can be no space between "link:" and the URL.

Note: No other query terms can be specified when using this special query term.

Related Links related:www.hp.com/go/java The query prefix, "related:" will search for pages similar to the specified URL. Note there can be no space between "related:" and the specified URL.
Cached Results Page cache:www.faqs.org/faqs/hp/hpux-faq/ download patch bundle The query prefix, "cache:", will return the cached HTML version of the specified web document that the Google search crawled.  Note there can be no space between "cache:" and the web page URL.

If you include other words in the query, Google will highlight those words within the cached document. However, the Google toolbar currently doesn't support this.

Stock Symbol Lookup stocks:HPQ IBM

stocks: HPQ IBM

The query prefix "stocks:" will display detailed stock info for the specified stock symbol(s).
PhoneBook Lookup (all) phonebook:home depot,08075

phonebook:856-764-0120

The query prefix "phonebook:" will look up the specified business or individual in the online white pages.
PhoneBook Lookup (businesses only) bphonebook:home depot,08075 The query prefix "phonebook:" will look up the specified business in the online white pages.
PhoneBook Lookup (residences only) rphonebook:greg,pavlik,08075 The query prefix "phonebook:" will look up the specified individual in the online white pages.
Web Document Info info:link:www.faqs.org/faqs/hp/hpux-faq/ The query prefix, "info:", will return a single result for the specified URL if it exists in the index.

Note: No other query terms can be specified when using this special query term.

The Unofficial Google FAQ
Compiled by Ian Springer - Last Updated 08/07/03