I know that there is a limit on how much data can a cookie hold, but is there a limit on how many cookies can we set?
Yes, one domain can generate many cookies. The maximum number varies by browser.
If you want to support most browsers, then do not exceed 50 cookies per domain, and 4093 bytes per domain. That is, the size of all cookies should not exceed 4093 bytes. Cookies are sent on every request for a domain, this includes images.
According to Microsoft its 4096 bytes. cookies are usually limited to 4096 bytes and you can't store more than 20 cookies per site. By using a single cookie with subkeys, you use fewer of those 20 cookies that your site is allotted.
According to Cookiebot, websites use around 20 cookies on average, most of which are loaded by other third-party cookies, which makes them very difficult to detect. This seems like a lot, and it is.
Based on my own research, I suggest that you do not exceed 50 cookies per domain, and 4095 bytes per domain. That is, the size of all the cookies on your domain should not exceed 4095 bytes.
If you want to read more, I have shared my research here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With