What is a HTTP cookie?

Posted: (EET/GMT+2)

 

If you develop web applications, you will eventually encounter cookies. A cookie is a small piece of information stored by the browser on behalf of a web site.

A web server can send a cookie using an HTTP response header field:

Set-Cookie: Username=John

The browser stores this value and sends it back with future requests to the same domain.

Cookies are commonly used for:

  • User preferences
  • Authentication
  • Session tracking
  • Personalization.

Without cookies, web applications would have difficulty remembering information between requests.