Sobes.tech
Middle

Why is the size of a cookie strictly limited?

sobes.tech AI

Answer from AI

The size of cookies is limited to prevent network traffic overload during each HTTP request to a domain. Cookies are sent with every request to the server, and their large size would significantly increase the amount of data transmitted between the client and the server.

The size restrictions are standard:

  • 4096 bytes (approximately 4KB) per cookie.
  • About 20-50 cookies per domain.
  • The total number of cookies may be limited by the browser.

This balances the ability to store a small amount of user information on the client with minimizing network and server load.

Why is the size of a cookie strictly limited? — Node.js - sobes.tech