87

Let's say I set a cookie using the setcookie() function in PHP:

setcookie('name','foo',false,'/',false);

I can see it in:

chrome://settings/cookies 

However, I can not find the actual file stored on my hard disk. Can anyone tell me where this specific cookie is stored on the hard disk?

6
  • By default, it's a file saved in the path pointed to by the session.save_path setting in your php.ini
    – Mark Baker
    Commented Jun 24, 2015 at 8:44
  • 1
    Do you wonder where the cookie is stored on the server, or in the browser? Because what you see when using chrome://settings/cookies is the cookies in the browser, which have no idea what cookies could possibly be stored in the server. Commented Jun 24, 2015 at 8:46
  • 2
    The cookie is on client side no? so i'm wondering where is it stored on the client side on hard disk @JoachimPileborg. I can see other cookies saved on my hard drive by the websites i visited but i can not find the cookie i just created.
    – Kobayashi
    Commented Jun 24, 2015 at 8:59
  • See superuser.com/questions/459426/…. All browsers use similar schemes. Commented Jun 24, 2015 at 9:00
  • I already looked it up, I can see other cookies created by other websites on my hard drive but the actual cookie that i created by php as explained above seems missing?!!
    – Kobayashi
    Commented Jun 24, 2015 at 9:08

9 Answers 9

115

The answer is due to the fact that Google Chrome uses an SQLite file to save cookies. It resides under:

C:\Users\<your_username>\AppData\Local\Google\Chrome\User Data\Default\Network

inside Cookies file. (which is an SQLite database file)

So it's not a file stored on hard drive but a row in an SQLite database file which can be read by a third party program such as: SQLite Database Browser

EDIT: Thanks to @Chexpir, it is also good to know that the values are stored encrypted.

10
  • 10
    It's important to add that the cookie value is stored encrypted.
    – Chexpir
    Commented Jun 30, 2016 at 14:19
  • 17
    Is there any way to view the encrypted Cookies file using SQLite Database Browser?
    – whitwhoa
    Commented Jul 5, 2016 at 16:34
  • 6
    FYI, in Debian 6 (Squeeze), said Cookie file can be found in ~/.config/chromium/Default
    – Digger
    Commented Nov 8, 2017 at 18:31
  • 2
    Windows Data Protection API (DPAPI) is some tool in Windows? If so, can attacker after obtaining file, decrypt it on another computer? Commented Dec 10, 2017 at 17:09
  • 7
    They have just been moved to the subfolder \Default\Network\Cookies
    – pizzaboy
    Commented Feb 15, 2022 at 9:50
33

For Google chrome Version 97.0.4692.71 (Latest Release) cookies are found inside the Network folder.

There is a file called "Cookies".

Path : C:\Users\user_name\AppData\Local\Google\Chrome\User Data\Default\Network

Remember to replace user_name.

2
  • 1
    Reference: https://dfir.blog/cookies-database-moving-in-chrome-96/
    – ceprio
    Commented Jan 20, 2022 at 14:09
  • 2
    Note, if the user uses Chrome profiles, then cookies will be stored in C:\Users\<your_username>\AppData\Local\Google\Chrome\User Data\Profile [n]\Network where [n] is the profile number (1,2,3, etc)
    – n00b
    Commented Jul 30, 2022 at 15:18
8

Windows:

C:\Users\<username>\AppData\Local\Google\Chrome\User Data\<profile>\Network\Cookies

You'll need a program like SQLite Database Browser to read it. However, do not that values are stored with encryption.

macOS:

~/Library/Application Support/Google/Chrome/Default/Cookies
3

Actually the current browsing path to the Chrome cookies in the address bar is: chrome://settings/content/cookies

3

On Windows the path now is:

C:\Users\<username>\AppData\Local\Google\Chrome\User Data\<profile name>\Network\Cookies

Chrome doesn't store each cookie in a separate text file. It stores all of the cookies together in a single SQLite file called Cookies in the profile folder as mentioned above. The cookies values are also stored in an encrypted manner and thus not directly readable.

2

Chromium on Linux: it's an SQLite3 database, located at:

~/.config/chromium/Default/Cookies

Google Chrome is going to be similar, try replace with

2

In case you came here to find out how to see info about the cookie of a particular website in Chrome, open Inspector (press F12) navigating the website, go to the tab Application/Aplicativo and look below in the left tree, there is Storage/cookies with all info:

  • cookie variables
  • content, length
  • expiration dates, etc
0
2

For Google chrome Version 56.0.2924.87 cookies are found inside profile1 folder.

If you browse that you can find variety of information.

There is a separate file called "Cookies". Also the Cache folder is inside this folder.

Path : C:\Users\user_name\AppData\Local\Google\Chrome\User Data\Profile 1

Remember to replace user_name.

For Version 61.0.3163.100
Path : C:\Users\user_name\AppData\Local\Google\Chrome\User Data\Default

Inside this folder there is Cookies file and Cache folder.

Edit: This is an outdated answer at this point of time. Browsers continue to evolve. :)

2
  • 1
    "Profile 1" is just a profile directory, for each Chrome profile cookies can be found i its profile directory: "Profile 2", "Profile 3", etc Commented Nov 4, 2019 at 8:23
  • 1
    If you're on windows, you can just use the environment variable %localappdata% instead of "C:\Users\<user_name>\AppData\Local". Commented Sep 7, 2020 at 19:25
0

Since the expiration time is zero (the third argument, the first false) the cookie is a session cookie, which will expire when the current session ends. (See the setcookie reference).

Therefore it doesn't need to be saved.

3
  • 1
    I tried it with setcookie('name','masoud',time()+3600,'/',false); ,yet i can not find the cookie file on my hard drive!!
    – Kobayashi
    Commented Jun 24, 2015 at 9:24
  • @varDumper Did you check the browsers SQLite cookie database? (Follow my Superuser link in a previous comment) Commented Jun 24, 2015 at 9:27
  • Thanks for your time dude, Yes i checked it. I know where chrome stores the cookies. As i mentioned above i can see all other cookies created by other websites. But the actual cookie that i created by php script seems missing!!
    – Kobayashi
    Commented Jun 24, 2015 at 9:34

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.