Firefox cookie database

Cookies in Firefox are stored in an SQLite format database found in the file cookies.sqlite in the currently-active user profile directory (exact path is system-dependent). Also, the write-ahead-logging and shared-memory files cookies.sqlite-wal and cookies.sqlite-shm are used, but the latter two are re-integrated into the main database file and deleted when you close the browser.

The structure is seen in this SQL command embedded in the file:

Firefox Contextual Identity Project (Containers)
Firefox has implemented OriginAttributes in internal APIs to support features like Multi-Account Containers. Based on that, the same cookie name at the same host on the same path may return multiple values due to different originAttributes values (representing different containers).

As of Firefox 104 (released 2022-08-23), the cookies.sqlite schema is:

The   clause makes SQLite require the quadruple of,  ,  ,   to be unique.

Datetime formats
There are 3 dateime fields: expiry, lastAccessed, and creationTime.

is stored in standard Unix timestamp format. In SQLite, this can be converted to a human-readable format with.

However,  and   are in microseconds since the Unix epoch. To convert to a human-readable format in SQLite use.

Links

 * Ad group blasts cookie-privacy project from Mozilla, Stanford
 * Commentary on Digital Advertising Alliance's criticism of Mozilla
 * Self-destructing cookie plugin: removes cookies when you close a tab
 * Plugin to get rid of cookie warnings
 * Mozilla Wiki - Security/Contextual Identity Project/Containers