Cookies have, for some reason, gained a rather sinister image. But they really are simple and harmless. (Note that this question became so popular that HowStuffWorks now has a complete article on cookies.)
A cookie is just one or more pieces of information stored as text strings on your machine. A Web server sends you a cookie and the browser stores it. The browser then returns the cookie to the server the next time the page is referenced.
The most common use of a cookie is to store a user ID. For example, the cookie might containg the following string:
Amazon.com is one site that uses this technique. When you order a book, you fill out a form with your name and address. Amazon assigns you an ID, stores your information with that ID in its database on the server, and sends the ID to your browser as a cookie. Your browser stores the ID on your hard disk. The next time you go to Amazon, the ID is sent back to the server. The server looks you up by your ID and customizes the Web page it sends back to you. The page might say, "Welcome back, Joe Smith!"
You may be wondering:
- Is there any more to cookies than that? No. They are simply text strings. On my machine there is a directory called c:\windows\cookies that contains all of the cookies. They are little text files -- you can open them up and see the strings that are being saved.
- Are cookies harmful? No. They are just short text strings, and they can often make browsing better by allowing a server to recall any customized information you have set.
- Are cookies common? Yes. There are over 500 separate cookies on my hard disk.
- Can cookies transmit computer viruses? No. They are just text strings.
- Can a company read my personal information from my hard disk with a cookie? No. Only the cookie that is sent in the first place is returned to the server. It is not modified or manipulated in any way.