How Google Search Works

When you press Enter, Google does not go out and search the internet. It searches a copy it made in advance: every page broken into words, every word given a line of page numbers like the index at the back of a book, and the whole index cut into slices so a thousand machines can each check one sliver at the same moment. Then links act as votes to decide which answer goes first.

How Google Search Works — interactive 3D animation

Step 01 of 08

1 · Ten answers in a fifth of a second

Type how do bees make honey and press Enter. Before your finger has left the key, the answers are on the screen, picked from hundreds of billions of pages. Nothing could read that many pages in a fifth of a second, so Google never tries. Everything on this table is how it gets away with that: a web of pages on the left, a giant index in the middle, a row of servers, and your screen.

Step 02 of 08

2 · The reading happened before you asked

Google runs programs called crawlers, nicknamed spiders, that never stop walking the web. One lands on a page, saves a copy, reads the links on it, and follows one to the next page. Then it does it again. Every copy goes home to Google, where the next step files it. So when you search, Google is not out on the internet at all. It is looking through the copy it already brought back.

Step 03 of 08

3 · Filed like the index at the back of a book

Each copy is broken into its words, and every word has one line in a giant index, the same trick as the index at the back of a textbook. Page 18 says bees, honey, hive, make and nectar, so the number 18 is written onto those five lines. Not the page, just its number. Every line keeps its numbers in order, smallest first. This is the slow, expensive work, and it is all done before anyone searches.

Step 04 of 08

4 · Answering without opening a single page

Now your question arrives, and Google still does not open any page. It pulls out two lines: every page that says bees, and every page that says honey. Then it runs along both at once, like two fingers on two lists. A number that sits on both lines is a page with both words. Here that is pages 7, 18, 31 and 44, found by comparing short lists of numbers, which a computer can do billions of times a second. A real search walks every word of your question this way, make included; we follow two to keep it readable.

Step 05 of 08

5 · A thousand machines, each with a sliver

The real index is far too big for one computer, so it is cut up by page number and each slice lives on its own machine. Your question is copied to every slice at the same moment. Each machine checks only its own pages and sends back its best few. The one holding pages 20 to 29 finds nothing, so it sends nothing. A front server merges the replies. Because every slice works at once, searching the whole index takes about as long as searching one slice. In 2009, Google said a single search touched about 1,000 machines and still finished in about 0.2 seconds.

Step 06 of 08

6 · Every link is a vote

Finding pages that contain your words is the easy half. Millions of real pages say bees and honey, so which one goes first? Google started with links. Every link counts as a vote for the page it points to, and votes are weighted: a page splits its own score among its links, so a link from a page that many others link to carries more. That is PageRank. Here each page is sized by its score, worked out from exactly these links. The encyclopedia has the most links pointing in, eleven. Page 18 has only six, yet it comes out on top, because one of its six comes from the encyclopedia and two more come from bee pages, 31 and 7, that are well linked themselves.

Step 07 of 08

7 · Hundreds of clues become one order

Links are only one clue. Google weighs hundreds: whether your words appear in the title and close together, whether the page means what you meant, how recently it changed, and where you are and what language you read. Each clue adds to one score, and the results are sorted by it. Watch the four matches arrive in page-number order, then slide into score order. About 15% of what people search each day has never been searched before, so this has to work on questions nobody has asked yet.

Step 08 of 08

8 · Run it

Crawl, copy, file, look up, split, score, sort. The slow part, reading the web, was finished long before you typed. All that is left when you press Enter is looking up numbers in an index that is already sorted, and that is why it feels instant.