maximum size of cookie content

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jasongr
Forum Contributor
Posts: 206
Joined: Tue Jul 27, 2004 6:19 am

maximum size of cookie content

Post by jasongr »

Hi people

I was wondering if anyone knows whether there is a maximum size limit on a cookie content

If so,
1) Is this a limit per cookie in a single domain? i.e. no single cookie value can exceed XX bytes
2) Is this a limit on all the cookies that get saved under a single domain? i.e. the total size of all the cookies cannot exceed XX bytes
3) Is the limit different from browser to browser?
4) How can I detect what the limit is?

regards
User avatar
Maugrim_The_Reaper
DevNet Master
Posts: 2704
Joined: Tue Nov 02, 2004 5:43 am
Location: Ireland

Post by Maugrim_The_Reaper »

No idea personally but a few sites carry the following rules of thumb:

http://www.devx.com/tips/Tip/12646

Based on that seems to be a limit (in general) of about 4098 bytes (4KB), and 20 cookies per domain per client. If you are running into cookie difficulties it may pay to use SESSIONs in PHP.
Post Reply