How much data, or how long a string, will a cookie hold?

Hello;

I am working on a web site that is going to need a cookie to hold a string of information.

I have got a few questions about storing data in a cookie:

1). How long a string of data, or how many characters, will a cookie hold?

Also, I am thinking about storing the data in a session cookie.

2-a). How much data will will a session cookie variable hold?

2-b). How much data will the entire session cookie hold?

Does anybody know where I can find answers to my questions?

Thanks.

I’m not sure what the limit is on cookies - sessions afaik don’t necessarily have a limit.

However, remember the rule of upper limits: if you have to ask what the upper limit is, you’re probably doing it wrong.

Not sure what you’re trying to do exactly, but you shouldn’t need to store a ton of information in either. Just store an identifying key in the session, and use that to pull the information you need from the database.

Yep. :slight_smile:

RFC 2965 - HTTP State Management Mechanism (RFC2965)

aamonkey, AnthonySterling;

Thanks for responding to my question.

For others who read this thread the link to the white paper provided by Anthony tells about storage requirements for cookies. It’s about 3/4 down the page under the subheading “5.3 Implementation Limits”

It says there “In general, user agents’ cookie support should have no fixed limits.” (I think the term user agents refers to browsers)

I think that a cookie is like any other text file. I suppose that you can put lots of information in one. The limitation is only how much data your computer can handle. Most computers can handle huge text files.

It also says that the user agent (i.e. browser) should have the capacity to contain at least 4096 bytes of data in a cookie (if I am reading it right).

One byte of data equals one keyboard character.

Thanks again.