How Search Engines Work: Crawl, Index, Rank

How a query becomes 1.5 million results in 0.4 seconds

1

Step 1: A Crawler Walks the Web

A search engine starts with a crawler: a program that visits a web page, reads it, and follows every link it finds. Then it visits those pages and follows their links. The web becomes a giant graph the crawler walks. Click "Crawl" to send the spider out.

Click a starting page to send the crawler out.

crawl(page): for each link in page: if not seen: visit(link); crawl(link)
Google's crawler "Googlebot" visits an estimated 50 billion pages per month. It uses millions of computers in parallel and respects "robots.txt" files that tell it which pages to skip.
2

Step 2: The Inverted Index

Reading every page for every search would take forever. Instead, search engines build an inverted index: a map from each word to the list of pages it appears on. When you search "robot", the engine doesn't read pages, it just looks up "robot" in this map. Type a query to see it work.

Type a word and click Search to look it up in the index.

index["robot"] → [page_3, page_7, page_12, ...]
An inverted index is just a hash table. Looking up a word takes constant time, no matter how many pages exist. Google's index is hundreds of petabytes spread across thousands of servers.
3

Step 3: PageRank — Links as Votes

Many pages might match your query. Which one shows up first? PageRank treats every link as a vote: a page is important if other important pages link to it. Click pages to add new links and watch the rankings shift.

Click and drag from one page to another to add a link. Watch the larger circles get bigger as more pages link to them.

PageRank(P) = sum of PageRank(Q) / outLinks(Q) for every Q linking to P
PageRank is an iterative algorithm. Start with every page at rank 1, then repeatedly redistribute rank along links until it stabilizes. Larry Page and Sergey Brin invented it as Stanford grad students in 1996. Two years later they founded Google.
4

The Modern Ranker: Hundreds of Signals

PageRank was the breakthrough, but today's search uses far more. Each of these factors adjusts where a page lands. Modern engines also use AI models that read your query and the page text to figure out what you actually mean.

Text Relevance

Does the page contain your exact words? In the title? In headings? Repeated naturally? Older techniques like BM25 and TF-IDF measure this. Newer ones use neural embeddings to match meaning, not just words.

PageRank & Links

How many sites link here, and how trusted are those sites? A link from a major news site counts more than a link from a random blog. Spam links are detected and discounted.

Freshness

For news and trending topics, recent pages rank higher. For "how do volcanoes work", a 10-year-old page might be just fine. The engine guesses how much freshness matters per query.

User Clicks

If everyone who searches "best pizza near me" clicks the third result and ignores the first two, the engine learns to promote that third result. This feedback loop is huge.

Page Speed & Mobile

Slow pages drop in ranking. Pages that aren't mobile-friendly drop on phones. Google has used these as ranking factors since 2018.

Personalization

Your location, language, and past searches all tweak results. "Football" means different sports in the US vs Europe. The engine quietly adapts.

Fun Fact

The first web search engine, Archie (1990), didn't even read web pages. It just listed file names on FTP servers. The full text of pages wasn't searchable until 1993, when WebCrawler launched. Google didn't arrive until 1998 and changed everything by ranking with links instead of just keywords.

Search Engine Architect!

You've seen how a search engine turns the entire web into instant answers. Three big ideas: a crawler walks every link to find pages, an inverted index maps words to pages so lookups are fast, and PageRank uses links as votes to rank the best results first. Every Google search uses these same ideas at planet scale.

0
Pages Crawled
0
Searches Run
0
Time Exploring

Crawlers Walk the Web

A crawler (also called a spider or bot) starts on a few known pages, follows every link, then follows every link on those pages. Google's crawlers visit billions of pages a day.

Inverted Indexes Make Search Fast

Instead of reading every page for every query, search engines build an "inverted index": a giant map from each word to the list of pages it appears on. Looking up a word becomes a single hash table lookup.

PageRank: Links Are Votes

A page is important if other important pages link to it. PageRank treats every link like a vote, and votes from highly-ranked pages count more. Larry Page and Sergey Brin used this idea to build Google in 1998.

Ranking Uses Hundreds of Signals

Modern search engines use far more than PageRank: text relevance, page speed, freshness, user clicks, mobile-friendliness, and increasingly AI models that understand meaning, not just keywords.

Ready to Create?

Put your new knowledge into practice!

Suggest a Correction