Comparisons

Cookie vs LocalStorage vs SessionStorage

Venn Diagrams · made in Skemio

Venn diagram of Cookie, LocalStorage, and SessionStorage showing differences in HTTP transmission, persistence, and storage capacity.
Venn diagram of Cookie, LocalStorage, and SessionStorage showing differences in HTTP transmission, persistence, and storage capacity.

What it shows

  • Cookies travel with every HTTP request and support secure HttpOnly flags.
  • LocalStorage persists 5-10MB across browser tabs until explicitly cleared.
  • SessionStorage isolates 5MB of data to a single active browser tab.

The takeaway

Store auth tokens in HttpOnly cookies; use Web Storage exclusively for non-sensitive UI state.

More venn diagrams