After GDPR, we were all made painfully aware of just how common cookies are in our internet browsing sessions. But what do they actually do? And what makes them different from cache, the other thing we’re always told to delete to solve internet issues? Here’s an article that will clear it all up.
Table of contents
Cache vs. cookies: in short
Cache saves the website resources (images, videos, etc.) on your device to make it load faster on repeated use.
Cookies are created on your device by the website you visit to help the website remember you.
What is cache?
Cache makes websites load faster by saving heavier webpage resources on your device. Data stored in a cache is usually static and unchanging, which is why you don’t need to download it every time you visit the page. Examples of what cache stores are:
- Images (logos, background, cat pictures, etc.);
- Videos (you know, YouTube);
- HTML, CSS, JavaScript (bits of code).
A non-obvious thing about using the web is that everything you see on web pages is downloaded and stored on your device in some shape or form — otherwise, you wouldn’t be able to see it. Unlike right-clicking to save a cat picture or an NFT, this is done without your active participation — seeking your approval to download every aspect of the website is just impractical.
The same applies to bandwidth usage — it makes no sense to download the same image 100 times if you navigate through 100 pages of the website.
For example:
- You’re visiting Surfshark.com;
- The browser downloads the Surfshark logo in the top left corner once into the cache;
- The logo is loaded from the cache every time you go to a different page on Surfshark.com;
- You save around 6kB of data per page.
Some issues may arise if the web resources downloaded into the cache are corrupted by an interrupted download or some other issue. That’s why you may get broken website elements (it’s loading from the browser’s cache, file integrity be damned) or, potentially, not see the freshest version of the site. Clearing the cache makes the device re-download the website elements and solves that issue.
A browser cache can be cleaned out — deleted — manually. The web resources stored there are not required for the website to be used again. Once deleted, they can be re-downloaded. On devices with limited storage (old PCs, some smartphones, etc.), clearing the browser cache is the trick to free up space.
Note: Cache as a concept exists outside of web cache, but those don’t matter for the purposes of this article.
What is a cookie?
A cookie is a tiny file that a website uses to store information about you on your device. It helps the website “remember” user preferences. It stores the user ID and session ID as well as form-filling data, pages on the site you visited before, and what buttons you pressed.
A cookie may also include the contents of your online shopping cart, though the latter is often stored on the server side these days. That’s how you get those email reminders about the items left in your cart!
There are transient and persistent cookies. Transient cookies expire every time you close the browser, deleting any temporary tracking data they stored. Persistent cookies store data persistently, from browsing session to browsing session.
Cookie data is transmitted every time you make a request on the website. The simplest request is navigating to other pages on the site. By having the ID paired with the request, a website can personalize replies to you, the user. That’s one of the ways store sites know to display the exact contents of the shopping cart no matter what page you’re on.
Two significant variants of cookies-by-function are authorization cookies and tracking cookies:
Authorization cookies make it unnecessary to log into Facebook every time you enter Facebook.com. The cookie authenticates the user to the website automatically and thus saves you a few seconds. And yes, there have been security issues with the Magical File That Lets You Access An Online Account before.
Tracking cookies are persistent cookies that keep data on you and your browsing habits. They let a website owner know what pages a user visited in what order and how long they stayed there. Tracking cookies enable annoying “personalized” targeted ads, search results that are tailored to you, and marketing departments that get up in copywriters’ grill about “bounce rates” and other gibberish.
So, as we learned, some cookies are functional and required for the site to work properly. But as you’ve discovered with all the post-GDPR cookie warnings and settings*, a lot of them are garbage that increases your digital footprint, only benefiting the website and not you.
Note: A website server stores some data on you when you browse it. That data is called a “session,” and you can’t delete it since it’s not on your device.
*Tired of having to deal with the cookie warnings everywhere you go? Get our Cookie pop-up blocker!
What’s the difference between cache and cookies?
Having provided detailed descriptions above, here’s a table:
Chache | Cookies |
---|---|
Stores website information for repeated use. | Stores information about your interactions with the website. |
Stores images, videos, HTML pages, JavaScript, etc. | Stores your session ID, IP address, location, field entry results, etc. |
Stored on your device only. | Has a session counterpart on the web server. |
Takes up a lot of space. | Takes up very little space. |
Has to be cleaned manually. | Technically has an expiration rate. |
Is not sent to the website. | Is sent to the website with a request. |
Saves bandwidth and the time it takes to load. | Saves time for user interactions like typing stuff in or marking choices. |
Can be used to track you. | Is definitely used to track you. |
Deletion means re-downloading the assets next time you visit. | Deletion means reconfiguring all the user preferences next time you visit. |
Should I clear cache or cookies?
Whether you should clear cache or cookies depends on what you want to do.
- Clear cache if you want to see a fresh version of the website, solve website loading issues, or free up space;
- Clear cookies if you want to remove search history on websites, e.g., Facebook, protect your data on a shared device, and prevent tracking.
Is clearing cache and cookies bad?
By clearing cache and/or cookies, you always sacrifice convenience: next time you visit, the website will take more time to load, you’ll have to log into the accounts again, any site settings will be gone, and you’ll have to enter stuff into form fields anew.
That said, nothing vitally important relies on cache or cookies.
Is browsing history the same as cookies?
No. Browsing history is just a log of websites and pages you visited. Cookies store information about what you did on individual websites.
In conclusion: take a look at your own cookies
Cookies and cache are but two of the many technologies that make the internet work. In a vacuum, they’re neither good nor bad — they’re just there. However, the way businesses approach the online world — and how they extract profit from it — means that they can be used for nefarious purposes.
But after reading this article, you’re now better suited to deal with all of that. So, how about you start using a search engine that doesn’t use cookies to push targeted ads? That’s just one of the many benefits of using Surfshark Search!
FAQ
Are cookies harmful to a computer?
No, cookies are not harmful to a computer or any other device. By default, they’re just a tiny bit of internet infrastructure.
Crumbling an actual physical cookie into the insides of your computer isn’t recommended.
Does every website use cookies?
Almost every website uses cookies, sometimes multiple ones. That’s why some cookie consent forms have several types of cookies you can choose not to accept.
Why are websites asking about cookies?
The General Data Protection Directive (GDPR) of the European Union laid out transparency requirements about what data websites collect and how they use it. That’s why you need to be informed and asked about cookie use. It’s genuinely a good thing, but most of us are too busy to be able to fully delve into it.
Does deleting cookies clear the cache?
No, deleting cookies will not delete the cache. They are two different things, unrelated in function and stored separately.