How the internet works - Cookies

You've almost certainly heard the term "cookie" before related to your web browser and the internet. Most people have a vaguely negative opinion of cookies (aren't they supposed to be bad for privacy or something?) but don't actually know how they work.

This video gives a simple overview of what cookies are, why they're necessary for the internet to work, and how they can sometimes be used in a way that violates user privacy:

A quick summary for those of you who don't like videos:

  • When you want to view a website, your computer sends a "request" to a server, and the server responds with the website you're trying to view.
  • Some websites are dynamic meaning you might see different things depending on who you are. For example, when I log in to Twitter, I see the people I'm following, not the people you're following.
  • Cookies are used to let a website remember who you are so it can show you the correct content.
  • The first time you visit a website, it will generate a long, random code to uniquely identify you. This creates a "session".
  • That code is sent back to your computer and saved in your browser as a cookie.
  • Every time you go back to that same site, your browser automatically sends it the cookie, so that the server can connect you to your session and remember who you are.
  • This is how logging in works. Without cookies, every time you visited a new page, you'd need to log in again because the server wouldn't remember you.
  • Cookies are used by advertisers to remember who you are across websites. This is why sometimes you'll search for a pair of shoes on one site, and then see an advertisement for that same pair of shoes on a different site.
Have thoughts on this post? I'd love to hear from you! I'm @TylerMKing on Twitter.