What Are Cookies on a Website?

GlossaryUpdated October 27, 20262 min read

Cookies are small text files that a website saves in your web browser so that it can remember information about you. They help sites function, such as keeping you logged in or remembering items in your shopping cart, and they are also used for analytics and advertising.

Types of cookies

  • Essential or strictly necessary cookies: needed for basic functions such as login sessions and security.
  • Preference cookies: remember settings such as language or layout.
  • Analytics cookies: collect data on how visitors use a site, usually to improve it.
  • Advertising and tracking cookies: record browsing habits to show targeted ads.
  • First-party cookies: set by the site you visit.
  • Third-party cookies: set by other domains, such as ad networks, embedded in the page.
  • Session cookies: deleted when you close the browser.
  • Persistent cookies: stay for a set period.

Why they matter for privacy

Cookies, especially third-party ones, can be used to follow your activity across sites and build profiles. Laws in many places, such as the EU's GDPR and ePrivacy rules and various national and state laws, require sites to inform users and in many cases ask for consent before setting non-essential cookies. Browsers have been restricting third-party cookies and introducing other privacy features, and the advertising industry is exploring alternatives.

Managing cookies

  • Use cookie banners: choose reject or customize when offered, accepting only the categories you need.
  • Adjust browser settings to block third-party cookies or clear cookies when you close the browser.
  • Use privacy tools, such as tracker blockers and private browsing, understanding their limits.
  • Clear cookies regularly, especially on shared computers.
  • Check site permissions, and remove those you do not need.

Blocking all cookies can break features, such as logins and checkouts.

Cookies and security

Session cookies can be stolen if a device is infected or if you use an insecure network, which could allow someone to access your accounts. Log out on shared computers, keep software updated and use two-factor authentication.

Related technologies

Other tracking methods include device fingerprinting, tracking pixels and local storage. They have similar privacy effects and may not be removed by clearing cookies.

For students

Understanding cookies helps you protect your privacy and manage the accounts you use for study, jobs and social media. In marketing courses, cookies explain how targeting and analytics work.

Related terms

See single sign-on, learning management system, algorithm, sponsored content and ugc.

Frequently asked questions

Are cookies dangerous?

Most are harmless and make sites work. Tracking cookies raise privacy concerns, and cookies can be misused if a device or account is compromised.

Should I accept all cookies?

Essential cookies are needed for sites to work. You can often decline analytics and advertising cookies, and choosing fewer cookies gives you more privacy.

How do I delete cookies?

In your browser's privacy or history settings, you can clear cookies for specific sites or all sites. You may need to sign in again afterward.