CodrGeek is optimized for learning, testing, and training. Examples might be simplified to improve reading and basic understanding. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using this site, you agree to have read and accepted our Privacy Policy Explore Now!

In which location cookies are stored on the hard disk ?

The location where cookies are stored on a hard disk varies depending on the web browser being used. In general, cookies are stored in a spe....

Cookies: Cookies are small text files stored on a user's device by a website. They are used to store information about the user, such as preferences, login credentials, and shopping cart contents so that the website can retrieve that information during future visits. Cookies are often used for session management, to keep track of a user's session as they navigate through a website.

Cookies are stored in the user's browser and are sent back to the server with each subsequent request to the website, allowing the server to access the stored information. Cookies can be set to expire after a specified amount of time or can persist until they are deleted by the user.

Cookies can also be used for tracking and advertising purposes, as they allow websites to store information about a user's browsing behavior and use that information to deliver targeted advertisements. This has led to some concerns about privacy and the use of cookies. However, many browsers now provide users with the option to control or block cookies, either on a site-by-site basis or globally.

Location of cookies on the hard disk: Cookies are small text that is stored on a user's computer or device by a website. The location where cookies are stored on a hard disk varies depending on the web browser being used. In general, cookies are stored in a specific folder or directory on the user's computer.

For example, chrome stores all cookies in a single file called cookies. To find the chrome cookie's location in the computer we have to open the file browser open c drive then go into users then the open folder with the administrator name there you find the App Data folder in that we have to go to the Local folder then in that we have to go to Google folder in that we have to open chrome folder in Chrome we have to open user data folder in that there will be a folder with name default there we see our system cookies.

File Path(Google): C:\Users\Your_User_Name\AppData\Local\Google\Chrome\User Data\Default.


File Path(Microsoft): C:\Users\Your_User_Name\AppData\Local\Microsoft\Edge\User Data\Default.


Note: For Microsoft Edge same path till the local folder in the local, we have to go into the Microsoft folder in which we open the Edge folder then the user Data then the default folder.

The cookies information inside the cookie file is not human-readable. If we want to see and manage the cookies, we have to use the browser's interface 

The user can access these folders and view or delete the cookies stored there. However, it's worth noting that some cookies are essential for the proper functioning of some websites, so be careful when deleting them.

Some modern browsers also support storing cookies in the browser's built-in memory, meaning that the cookie data is deleted once the browser is closed. These is known as session cookies, it's mainly used for authentication and session management.

Example: Set and get cookies using JavaScript 

  1. Create a new text file and save it with a .html extension, for example, cookie-example.html
    Open the file in a text editor, such as Notepad or Sublime Text
  2. Copy and paste the code into the file
  3. Save the file
  4. Open the file in a web browser, such as Google Chrome or Mozilla Firefox
  5. Open the developer console in the web browser. You can do this by right-clicking on the page and selecting "Inspect" or "Inspect 
  6. Element", then clicking on the "Console" tab.
  7. To get output, type document.cookie press enter in the console, which should show the cookie username we created  "John Doe".

Note: Keep in mind that cookies are stored on the client side, so you'll need to open the HTML file in a web browser on each individual device you want to test the code on.


function setCookie(cname, cvalue, exdays) {
    var d = new Date();
    d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
    var expires = "expires="+d.toUTCString();
    document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
  // Retrieving a cookie
  function getCookie(cname) {
    var name = cname + "=";
    var ca = document.cookie.split(';');
    for(var i = 0; i < ca.length; i++) {
      var c = ca[i];
      while (c.charAt(0) == ' ') {
        c = c.substring(1);
      if (c.indexOf(name) == 0) {
        return c.substring(name.length, c.length);
    return "";
  // Example usage:
  setCookie("username", "John Doe", 30);
  console.log(getCookie("username")); // Outputs "John Doe"



JavaScript is a client-side programming language that runs in the user's web browser, not on the server or the user's hard disk. This means that JavaScript has limited access to the user's device, and it can only interact with information that is stored in the browser's memory, such as cookies.

Cookies are small text files stored by the browser on the user's device, and they are used to store small amounts of data, such as user preferences or login information, between browser sessions. JavaScript can read and write cookies, but it does not have direct access to the user's hard disk. Instead, it can only manipulate the data stored in the browser's memory, including cookies.

For security reasons, JavaScript is designed to have limited access to the user's device, and it cannot access or manipulate data stored on the hard disk or any other physical storage. This is to prevent malicious scripts from compromising the user's privacy and security by accessing sensitive information stored on the device.

About the Author

Hey there! My name is Mayank, a professional Blogger, Graphic Designer, Coder as well as Content Creator from Uttar Pradeh, India. I love to Code and create interesting things while playing with it.

Post a Comment

Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
Site is Blocked
Sorry! This site is not available in your country.