Netscape to JSON Cookie Converter - Convert cookies.txt to JSON Online
Convert Netscape HTTP cookie files (cookies.txt) to structured JSON format instantly. Paste or upload your cookie file and download clean JSON output.
About
The Netscape cookie file format (commonly cookies.txt) remains the de facto interchange standard for HTTP cookie data across tools like curl, wget, and browser extensions. Each record contains 7 tab-delimited fields: domain, subdomain flag, path, secure flag, expiration epoch, name, and value. Misinterpreting field order or treating the boolean TRUE/FALSE flags as strings instead of proper booleans produces malformed data that silently breaks automation pipelines, API replay sessions, and scraping workflows. This converter parses each line with strict field validation, converts Unix epoch timestamps to ISO 8601 date strings, and outputs a clean JSON array ready for programmatic consumption.
The tool handles comment lines (prefixed with #), the optional #HttpOnly_ prefix that Chromium-based browsers prepend to httpOnly cookies, and blank lines. It does not guess or autocorrect malformed rows. If a line has fewer than 7 fields, it is flagged as an error with its line number. Pro tip: some export extensions insert a header comment block - this converter skips those automatically, but verify your expiration values are in seconds (not milliseconds) since Unix epoch.
Formulas
Each valid line in the Netscape format follows this tab-separated structure:
domain ⟶ flag ⟶ path ⟶ secure ⟶ expiration ⟶ name ⟶ value
The epoch-to-date conversion applies the standard transformation:
date = new Date(epoch × 1000)
Where epoch is the integer from field 5 and the multiplication by 1000 converts seconds to milliseconds as required by JavaScript's Date constructor.
The HttpOnly detection rule applies when a line starts with the literal prefix #HttpOnly_. The domain is extracted as:
domain = slice(line, 10)
Where 10 is the character length of #HttpOnly_.
Boolean mapping: TRUE → true, FALSE → false. Any other value flags the line as malformed.
Where domain = cookie domain string, flag = subdomain inclusion boolean, path = URL path scope, secure = HTTPS-only boolean, expiration = Unix epoch in seconds, name = cookie key, value = cookie data.
Reference Data
| Field Position | Field Name | Type | Example Value | JSON Key | Description |
|---|---|---|---|---|---|
| 1 | Domain | string | .example.com | domain | Cookie domain. Leading dot indicates subdomain inclusion. |
| 2 | Include Subdomains | boolean | TRUE | includeSubdomains | Whether all subdomains can access this cookie. |
| 3 | Path | string | / | path | URL path the cookie applies to. |
| 4 | Secure | boolean | FALSE | secure | If TRUE, cookie sent only over HTTPS. |
| 5 | Expiration | integer | 1735689600 | expiration | Unix epoch timestamp in seconds. 0 means session cookie. |
| 6 | Name | string | session_id | name | The cookie name (key). |
| 7 | Value | string | abc123xyz | value | The cookie value. May contain URL-encoded characters. |
| Common Netscape Cookie File Headers & Flags | |||||
| - | Comment Line | prefix | # Netscape HTTP Cookie File | - | Lines starting with # are ignored during parsing. |
| - | HttpOnly Prefix | prefix | #HttpOnly_.example.com | httpOnly: true | Chromium extension adds this prefix. Domain extracted after prefix. |
| - | Session Cookie | epoch | 0 | expirationDate: null | Expiration of 0 indicates cookie expires when browser session ends. |
| JSON Output Format Options | |||||
| - | Flat Array | format | [{...}, {...}] | - | Standard array of cookie objects. Most compatible. |
| - | Grouped by Domain | format | {"domain": [...]} | - | Cookies grouped under their domain key for easier lookup. |
| Epoch Timestamp References | |||||
| - | Unix Epoch Start | date | 0 | - | January 1, 1970 00:00:00 UTC |
| - | Year 2038 Problem | date | 2147483647 | - | Max 32-bit signed integer. Some systems overflow after this. |
| - | Common "Forever" Value | date | 9999999999 | - | Often used as "never expires". Equals Nov 20, 2286. |
| - | Millisecond Confusion | trap | 1735689600000 | - | If epoch > 9999999999, likely milliseconds. Divide by 1000. |