How Many Cookies Can You Use on One Website?

Different browsers have different limits

Adult hand in a glass cookie jar

Patrick La Roque / Getty Images

Programmers should be aware of how many cookies can be used on one website. Cookies take up space both in the HTTP stream when loading a webpage and on the computer that loads it. Most browsers put a limit on the number of cookies any one domain can set. The minimum is set by the Request for Comments (RFC) standard established by the Internet Engineering Task Force, but browser makers can increase that number.

Cookies have a small size limit, so developers sometimes opt to send their cookie data in multiple cookies. That way, they increase the amount of data the computer stores.

What Does the Cookie RFC Allow?

RFC 2109 defines how cookies should be implemented, and it defines minimums that browsers should support. According to the RFC, browsers would ideally have no limits on the size and number of cookies a browser can handle, but to meet the specifications, the user agent should support:

  • At least 300 cookies total.
  • At least 20 cookies per unique host or domain name.

For practical purposes, individual browser makers set a limit on the total number of cookies any one domain or unique host can set as well as the total number of cookies on a machine.

When Designing a Site With Cookies

The popular and lesser-known browsers all support a vast total number of cookies. So, developers who run a lot of domains need not be concerned that the cookies they create are going to be deleted because the maximum number has been reached. It is still a possibility, but your cookie is more likely to be removed as a result of readers clearing out their cookies than from the browser maximum.

The number of cookies any one domain can have is relatively small. Chrome and Safari appear to allow more cookies per domain than Firefox, Opera or Internet Explorer. To be safe, it's best to stick with 30 to 50 maximum cookies per domain.

Cookie Size Limit per Domain

Another limit that some browsers implement is the amount of space a single domain can use for cookies. This means that if your browser sets a limit of 4,096 bytes per domain and you can set 50 cookies, the total amount of space those 50 cookies can use is just 4,096 bytes — about 4KB. Some browsers don't set a size limit. For example:

  • Chrome has no limit on the maximum bytes per domain.
  • Firefox has no limit on the maximum bytes per domain.
  • Internet Explorer allows between 4,096 and 10,234 bytes.
  • Opera allows 4,096 bytes.
  • Safari allows 4,096 bytes.

Cookie Size Limits You Should Follow

To be compatible with the widest range of browsers, create no more than 30 cookies per domain and make sure all 30 cookies take up no more than 4KB of space in total.

Format
mla apa chicago
Your Citation
Kyrnin, Jennifer. "How Many Cookies Can You Use on One Website?" ThoughtCo, Apr. 5, 2023, thoughtco.com/cookie-limit-per-domain-3466809. Kyrnin, Jennifer. (2023, April 5). How Many Cookies Can You Use on One Website? Retrieved from https://www.thoughtco.com/cookie-limit-per-domain-3466809 Kyrnin, Jennifer. "How Many Cookies Can You Use on One Website?" ThoughtCo. https://www.thoughtco.com/cookie-limit-per-domain-3466809 (accessed April 25, 2024).