Transfer of Web pages follows the HyperText Transfer Protocol (HTTP). Regardless of cookies, browsers request a page from web servers by sending them a usually short text called HTTP request. For example, to access the page <nowiki>http://www.example.org/index.html</nowiki>, browsers connect to the server <nowiki>www.example.org</nowiki> sending it a request that looks like the following one:

The server replies by sending the requested page preceded by a similar packet of text, called 'HTTP response'. This packet may contain lines requesting the browser to store cookies:

The server sends the line codice_6 only if the server wishes the browser to store a cookie. codice_6 is a request for the browser to store the string codice_8 and send it back in all future requests to the server. If the browser supports cookies and cookies are enabled, every subsequent page request to the same server will include the cookie. For example, the browser requests the page <nowiki>http://www.example.org/spec.html</nowiki> by sending the server <nowiki>www.example.org</nowiki> a request like the following:

This is a request for another page from the same server, and differs from the first one above because it contains the string that the server has previously sent to the browser. This way, the server knows that this request is related to the previous one. The server answers by sending the requested page, possibly adding other cookies as well.

The value of a cookie can be modified by the server by sending a new codice_9 line in response of a page request. The browser then replaces the old value with the new one.

The term "cookie crumb" is sometimes used to refer to the name-value pair. This is not the same as breadcrumb web navigation, which is the technique of showing in each page the list of pages the user has previously visited; this technique may however be implemented using cookies.

The codice_6 line is typically not created by the base HTTP server but by a CGI program. The basic HTTP server facility (e.g. Apache) just sends the result of the program (a document preceded by the header containing the cookies) to the browser.

Cookies can also be set by JavaScript or similar scripts running within the browser. In JavaScript, the object codice_11 is used for this purpose. For example, the instruction codice_12 creates a cookie of name codice_13 and value codice_14.

Setting a cookie
Client-side persistence
Drawbacks of cookies
Session management