Maximum number and size of cookies

Asked

Viewed 3,210 times

8

When investigating about cookies and their limitations, I came across this Microsoft page where they talk about Internet Explorer and its capabilities regarding Cookies:

Size and number limits of a cookie in Internet Explorer

Microsoft Internet Explorer complies with the following RFC 2109 recommended minimum limitations:

  • at least 300 cookies
  • at least 4096 bytes per cookie (as measured by the size of the characters that make up the terminal in the description of the Set-Cookie header syntax)
  • at least 20 cookies per host name or exclusive domain

I also saw the rules:

that establish the basic behavior to standardize the use and availability of cookies in the various browsers available, where in summary speak that browsers limited at least make available what was already mentioned in the above mentioned article.

However, I have not been sufficiently clear about a acceptable number of cookies that will work in all most used browsers (English), as well as the maximum size that each cookie may contain in order to ensure that there will be no data loss in the application.

There is doubt about the most used browsers (IE, FF, Chrome and Safari), whether they will be governed by the minima mentioned above, or indeed we have a little more leeway for the use of cookies from the same domain.

Similarly, when they refer to domain in the standards presented, are saying that www.site.com is different from app.site.com, or the limits will have to be shared by both?

Question

Assuming a scenario of the kind:

  • www.mysite.com Institutional web-site
  • app.mysite.com Desktop app
  • m.mySite.com Version mobile of the institutional web-site
  • cdn.mysite.com CDN serving shared images and resources to those listed above

What can be counted on in terms of number of cookies and their value in bytes to ensure that the solution to the *.mySite.com will work?

  • My Chrome supports approximately 120 cookies. I realized this a few days ago after accessing a website where, for each page accessed, a cookie was set. After a while, I could no longer access the site. After clearing some cookies, I was able to access until the limit was reached again.

1 answer

5

According to Internet Explorer Cookie Internals both Internet Explorer and Firefox have a limit of 50 cookies per domain and:

  • each cookie cannot be more than 5kb;
  • Document.cookie has its own limit of only 10kb;

Answering your question:

What you can count on in terms of number of cookies and your value in bytes to ensure that the solution to *.mySite.com will work?

You can count on up to 50 cookies and a maximum of 250kb of data per request per site.

My advice is that you forget cookies and start using localStorage. Basically it is supported on all modern versions of browsers (IE since version 8, safari version 4) and supports large amounts of data.

  • I was going to ask that, but it’s very clear. + 1

Browser other questions tagged

You are not signed in. Login or sign up in order to post.