Whenever you run a search on Google, millions of lines of code are executed to try and find the most relevant sites for your search term. To do this in the fastest possible time, Google uses a series of steps to cut down on the search time, and optimize the search results. Many of these steps are constantly taking place and are being done independent of any searches.

In order to quickly search pages for your key terms, Google must first have a list of all the sites it knows about and have these sites indexed in a way that makes searching for key terms much faster. Google accomplishes this by the use of programs called “Web Crawlers” or “Spiders”. These programs start at a known page and are programmed to follow all the links on the page to go to a new page, then follow those links and so on to find new pages and index them in a connected list. Google then takes these sites and keeps a cached list of the sites on their servers to search the pages for your keywords or phrases.

All of this is constantly occurring and is what is used when you want to start a search. So, when you type in a search, the first thing google does is check your search for spelling mistakes and try to determine what you are searching for through word choice. For example, the word change may have several meanings for it, so google would use the other words in the search to determine if you are looking to replace something, talking about money, or trying to adjust something on a computer, like brightness. Once it is done Google quickly scan every page for your terms to pull only the pages that contains any of those parameters. From there Google uses an algorithm created by their founders known as the “Page Rank” which uses over 200 questions to rank pages by relevance to the search. Some of these questions are things like, how many times the words appear in the page, are they found in sequential order on the page, and are these words in the page title or URL. Once Google determines the Page Ranks of the search it then lists the pages in order of importance, and if applicable also lists advertisements related to the search on the right side and above the search links.

As Google continues to prosper as a company, they also continue to update their search algorithms by trying to improve the quality of searches for users. One such way that Google has improved their search algorithm by using information about the person searching the web. For example, if you typed in a search on Football scores, Google would determine where you lived and guess, based on what country you live in, if you mean American Football, or Soccer. From there Google can also narrow the search by showing you scores from local teams based on your current location.

If you want to go further in depth here is Google’s page on How Google Search Works.