DevOps · K8s · Volleyball · Travel  •  DevOps · K8s · Volleyball · Travel  •  DevOps · K8s · Volleyball · Travel
Explore NY Stream

What Happens When You Type a URL and Press Enter?

— ny_wk

What Happens When You Type a URL and Press Enter?

It's one of the most-asked interview questions in tech for good reason: explaining what happens between hitting Enter and seeing a page touches DNS, networking, security, and browsers all at once. Here's the whole journey, step by step and in plain language.

First, what is a URL?

URL stands for Uniform Resource Locator — literally the address of the resource you want. Like a friend's home address tells you where to go, a URL tells your browser where to find a page. A URL like https://example.com/blog?id=5 has parts: the scheme (https), the host/domain (example.com), the path (/blog), and an optional query (?id=5).

Step 1 — DNS: turn the name into an IP

Computers route by IP address, not names. So the browser first resolves example.com to an IP via DNS — checking its cache, then the OS, then a DNS resolver that walks the DNS hierarchy until it returns the IP.

Step 2 — Open a TCP connection

With the IP in hand, the browser opens a TCP connection to the server (the three-way handshake: SYN, SYN-ACK, ACK). This reliable channel is what HTTP rides on.

Step 3 — TLS handshake (for HTTPS)

If it's https, a TLS handshake follows: the server presents its certificate, the two sides agree on encryption keys, and the connection becomes secure. Now nobody in the middle can read the traffic.

Step 4 — Send the HTTP request

The browser sends an HTTP request — method (GET), path, headers (host, cookies, user-agent). The server reads it and figures out what you asked for.

Step 5 — Server responds

The server processes the request (maybe hitting an app and database) and returns an HTTP response: a status code (200, 404, 301...), headers, and the body — usually HTML.

Step 6 — The browser renders the page

The browser parses the HTML into a DOM, fetches linked assets (CSS, JavaScript, images — each often its own request), builds the render tree, lays it out, and paints pixels. JavaScript may then change the page further. What felt instant was all of this.

Key takeaways

  • A URL is just an address with a scheme, host, path, and optional query.
  • DNS turns the name into an IP; TCP opens the connection; TLS secures it for HTTPS.
  • The browser sends an HTTP request; the server returns a status + HTML.
  • The browser then parses, fetches assets, and renders the page.

Frequently asked questions

What does DNS do?

It resolves a human-readable domain (example.com) into the IP address computers use to route traffic.

What's the difference between HTTP and HTTPS?

HTTPS adds a TLS layer that encrypts the connection so data can't be read or tampered with in transit.

Why are there so many requests for one page?

The HTML references CSS, JavaScript, images, and fonts — the browser fetches each, often in parallel, to build the page.

What's a 301 vs 404?

301 means the resource moved permanently (redirect); 404 means it wasn't found.

DNS → TCP → TLS → request → response → render. Six steps, milliseconds apart — and that's the whole web in one keystroke.