8

As far as I read there is are two limits on the number of cookies :

  • 20 cookies per unique host or domain name
  • a total of 300 cookies

What does happen if I exceed one of these limits ?

Nix
  • 351
  • 5
  • 13

2 Answers2

7

Short Answer:

  1. If you exceed the limits per host/domain, the cookies simply won't be saved.

  2. If you exceed the total number of cookies, Your browser will alert you that the maximum number of cookies has been reached

Note that your question states that the max number of cookies per host is 20 and the total allowed is 300. However, this is not completely true. The number of maximum cookies is highly dependent on the Browser. For example,

  • Chrome 9 allowed 180 cookies per domain
  • Firefox 3.6.3 allowed 50 cookies per domain

As far as the RFC spec goes, the minimum requirements are:

  • at least 300 cookies
  • at least 4096 bytes per cookie
  • at least 20 cookies per unique host or domain name

This resource can help you test browser cookie limits. Also this SO post will shed some light on the design and performance aspect.

References: Cookie Limit per domain, Browser Cookie Restrictions

Niket Pathak
  • 6,323
  • 1
  • 39
  • 51
  • what do you mean by "at least 300 cookies" but " Chrome 9 allowed 180 cookies per domain Firefox 3.6.3 allowed 50 cookies per domain " ? – HoCo_ Aug 24 '18 at 12:05
  • 2
    it means that according to the RFC specs (check the link in the post), the requirements are that browsers support at least 300 cookies. But browsers are **not obliged** to comply. – Niket Pathak Aug 24 '18 at 12:13
  • The resource to help test browser cookie limits is down. Maybe [this page](http://browsercookielimits.iain.guru/) does something similar. – bluenote10 Apr 02 '21 at 10:20
  • Yes you're right. I updated the answer with the link you provided. Thanks! – Niket Pathak Apr 02 '21 at 15:54
4

I tried adding lots of cookies with a quick loop (100 at a time) both Chrome 69.0.3497 and FireFox 62.0.3 remove the older cookies and store the new ones.

antman3351
  • 436
  • 3
  • 8