80

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?

Kobayashi
  • 2,402
  • 3
  • 16
  • 25
  • By default, it's a file saved in the path pointed to by the `session.save_path` setting in your php.ini – Mark Baker Jun 24 '15 at 08: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. – Some programmer dude Jun 24 '15 at 08:46
  • 1
    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 Jun 24 '15 at 08:59
  • See http://superuser.com/questions/459426/where-does-chrome-store-its-cookie-file. All browsers use similar schemes. – Some programmer dude Jun 24 '15 at 09: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 Jun 24 '15 at 09:08
  • That's exactly where i get confused, cause i'm using the same machine as server and client (using localhost so my machine plays two roles, server and also client), So if i create a cookie, is the cookie get stored on the hard drive of the machine? (cause it's server and also client) if so where? if not how come that i can it on my browser settings? – Kobayashi Jun 24 '15 at 09:15

9 Answers9

104

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.

Aravind Nair
  • 13
  • 2
  • 5
Kobayashi
  • 2,402
  • 3
  • 16
  • 25
  • 7
    It's important to add that the cookie value is stored encrypted. – Chexpir Jun 30 '16 at 14:19
  • 15
    Is there any way to view the encrypted Cookies file using SQLite Database Browser? – whitwhoa Jul 05 '16 at 16:34
  • 1
    No, through SQListe Database Browser. But you can use Windows Data Protection API (DPAPI) to do so. – jkonst Aug 29 '17 at 09:09
  • 5
    FYI, in Debian 6 (Squeeze), said Cookie file can be found in `~/.config/chromium/Default` – Digger Nov 08 '17 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? – FantomX1 Dec 10 '17 at 17:09
  • I've downloaded DB Browser (SQLCipher) from https://sqlitebrowser.org/dl/ and on startup the app asks for the encryption key. Does anyone know how to find what Chrome uses ? Without the key you can't delete individual cookies, etc. – Someone Somewhere Oct 30 '19 at 10:12
  • Deleting cookies file won't clean all cookies. Where are the rest of the cookies? – JPX Aug 18 '21 at 05:25
  • I was able to read my Cookies file stored at the given location using SQLite Browser, which means that Cookies arent encrypted. – Abdul Rehman Dec 05 '21 at 06:04
  • 7
    They have just been moved to the subfolder \Default\Network\Cookies – pizzaboy Feb 15 '22 at 09:50
  • The cookies file is now \Network\Cookies . See answer by MFKDGAF. – Phil Goetz Mar 13 '23 at 20:06
31

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.

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

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
Aravind Nair
  • 13
  • 2
  • 5
Puru verma
  • 97
  • 2
  • 3
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.

Aravind Nair
  • 13
  • 2
  • 5
Pandi_Snkl
  • 476
  • 5
  • 16
3

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

George Smith
  • 438
  • 4
  • 8
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.

Aravind Nair
  • 13
  • 2
  • 5
SRIDHARAN
  • 1,196
  • 1
  • 15
  • 35
  • 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 – Sergei Krivosheenko Nov 04 '19 at 08:23
  • 1
    If you're on windows, you can just use the environment variable %localappdata% instead of "C:\Users\\AppData\Local". – user2863294 Sep 07 '20 at 19:25
1

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
Sergio Abreu
  • 2,686
  • 25
  • 20
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.

Some programmer dude
  • 400,186
  • 35
  • 402
  • 621
  • 1
    I tried it with `setcookie('name','masoud',time()+3600,'/',false);` ,yet i can not find the cookie file on my hard drive!! – Kobayashi Jun 24 '15 at 09:24
  • @varDumper Did you check the browsers [SQLite](https://www.sqlite.org/) cookie database? (Follow my Superuser link in a previous comment) – Some programmer dude Jun 24 '15 at 09: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 Jun 24 '15 at 09:34
0

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

~/.config/chromium/Default/Cookies

Google Chrome is going to be similar, try replace with

Michał Leon
  • 2,108
  • 1
  • 15
  • 15