3 min read Updated August 17, 2026

Fix cookies.txt expiry written in milliseconds

A cookies.txt millisecond expiry is a 13-digit number in column 5; this parser treats any value > 1e12 as milliseconds, divides by 1000, and warns Cookie "name" expiry looked like milliseconds; converted to Unix seconds.

JavaScript Date.now() is milliseconds. Netscape and chrome.cookies use seconds. JSON Array parse uses the same 1e12 threshold. Playwright’s expires: -1 is a different bug — session, not overflow.

cookies.txt millisecondsNetscape expiry milliseconds13-digit cookie timestampyt-dlp cookies expiry
  1. 1
    Open the failing jar

    If yt-dlp or curl rejects the file, look at column 5. Thirteen digits is the giveaway. Ten digits (around 1.7e9 in 2026) is correct.

  2. 2
    Paste here

    The sample is already milliseconds. Convert. Output Netscape with a 10-digit expiry. JSON output stores expirationDate in seconds.

  3. 3
    Replace the file

    Feed yt-dlp --cookies or curl -b the rewritten file. Do not convert seconds to milliseconds again in a JS snippet.

Cookies are credentials. Conversion stays in this page — delete the file when you are done.

Message → cause → fix

SymptomCauseFix
Warning: expiry looked like millisecondsColumn 5 or JSON expirationDate > 1e12Already converted on this paste
Cookie expires ~50,000 years out / client rejectsMilliseconds stored as secondsDivide by 1000 or use this converter
Cookie expired immediatelyPlaywright expires: -1 treated as a timestampstorageState guide — we treat ≤0 as session
Expiry 0Session cookieCorrect for Netscape session rows
Threshold 1e12 is about September 2001 in milliseconds and is far above any real Unix-second cookie expiry this century. Real second timestamps for 2026 are ten digits.

Same threshold in JSON and Netscape

            // JSON parseExpiration:
// num > 1e12 ? Math.floor(num / 1000) : Math.floor(num)

// Netscape column 5:
// 1789200000000  →  1789200000
          

Questions people ask

Will curl accept a 13-digit expiry?
Some builds store it as a far-future date; others reject the line. yt-dlp is often strict. Rewrite to seconds.
Does Chrome’s cookies API use milliseconds?
No. expirationDate is seconds. CookieMan JSON matches that. Do not multiply by 1000 when exporting for Chrome.
What about Max-Age on Set-Cookie?
Max-Age is a delta in seconds, added to now. It is not a 13-digit epoch. Different field, different bug.
3 min read

Fix: Skipped invalid Netscape line

CookieMan skips a Netscape row without seven fields. Editors that turn tabs into spaces are the usual cause. Paste the file here to reconstruct it.

Skipped invalid Netscape linecookies.txt spaces not tabs Open the guide
3 min read

Playwright storageState to cookies.txt

Paste a Playwright storageState file. The converter unwraps the cookies array, treats expires -1 as a session cookie, and writes Netscape for curl or Chrome JSON.

Playwright storageStatePlaywright cookies.txt Open the guide
3 min read

yt-dlp cookies.txt from Chrome Export

Convert Chrome JSON or a browser dump to the Netscape file yt-dlp --cookies expects, with tabs, Unix seconds and #HttpOnly_ session cookies intact.

yt-dlp cookies.txtyt-dlp --cookies Open the guide

Apply this on live cookies

The converter rewrites files. The extension reads and writes the jar in Chrome, including HttpOnly cookies.

Free and MIT-licensed · Chrome, Edge and other Chromium browsers · Nothing leaves your machine