72

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,232
  • 3
  • 14
  • 23
  • 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

8 Answers8

100

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\

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.

Kobayashi
  • 2,232
  • 3
  • 14
  • 23
  • 6
    It's important to add that the cookie value is stored encrypted. – Chexpir Jun 30 '16 at 14:19
  • 12
    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
  • 2
    They have just been moved to the subfolder \Default\Network\Cookies – pizzaboy Feb 15 '22 at 09:50
12

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
  • 121
  • 1
  • 2
  • 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
5
You can find a solution on SuperUser :

Chrome cookies folder in Windows 7:-

C:\Users\your_username\AppData\Local\Google\Chrome\User Data\Default\
You'll need a program like SQLite Database Browser to read it.

For Mac OS X, the file is located at :-
~/Library/Application Support/Google/Chrome/Default/Cookies
Puru verma
  • 97
  • 1
  • 3
3

On Windows the path is:

C:\Users\<current_user>\AppData\Local\Google\Chrome\User Data\<Profile 1>\Cookies(Type:File)

Chrome doesn't store each cookies in separate text file. It stores all of the cookies together in a single file in the profile folder. That file is not readable.

smci
  • 29,564
  • 18
  • 109
  • 144
Pandi_Snkl
  • 456
  • 5
  • 16
3

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

George Smith
  • 341
  • 3
  • 6
2

For Google chrome Version 56.0.2924.87 (Latest Release) 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.

Aaron Thoma
  • 3,492
  • 34
  • 33
SRIDHARAN
  • 1,065
  • 1
  • 15
  • 33
  • 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
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
  • 380,411
  • 33
  • 383
  • 585
  • 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
  • 1,926
  • 1
  • 14
  • 12