Developer Tools3 min read

How to Export cookies.txt from Chrome for yt-dlp

Why --cookies-from-browser chrome fails on Windows, how to export a Netscape cookies.txt from Chrome instead, and how to keep the file from leaking your login.

By Iliass El Barhoumi

Disclosure: I build CookieDesk, the extension this post features. The advice stands on its own; the tool is just how I put it into practice.

CookieDesk
How to Export cookies.txt from Chrome for yt-dlp

yt-dlp reads cookies from a cookies.txt file in Netscape format: export one from Chrome with a cookie extension, then run yt-dlp --cookies cookies.txt followed by the video's address. The shortcut --cookies-from-browser chrome often fails on Windows, because since Chrome 127 Chrome encrypts cookies so that only Chrome itself can read them (Google Security Blog). For YouTube, export from a private window, as yt-dlp's own guidance recommends, so the cookies are not rotated under you. CookieDesk, the cookie editor I build, exports cookies.txt; any tool that writes the Netscape format works.

Why --cookies-from-browser chrome Fails on Windows

In July 2024, Chrome 127 added app-bound encryption on Windows: cookies are encrypted with Chrome's own identity, so another program, yt-dlp included, cannot decrypt them even when it runs as your user. That is the "Failed to decrypt with DPAPI" error, tracked in yt-dlp issue #10927. On macOS and Linux, --cookies-from-browser chrome usually still works, so try it there first. On Windows, exporting a cookies.txt from inside Chrome is the reliable route.

Step by Step: Export cookies.txt With CookieDesk

  • Install CookieDesk from the Chrome Web Store
  • For YouTube: open chrome://extensions, click Details under CookieDesk and turn on "Allow in Incognito"
  • Open an incognito window (Ctrl+Shift+N, or Cmd+Shift+N) and sign in to the site
  • For YouTube, open youtube.com/robots.txt in that same tab, so no YouTube page is open to rotate the cookies
  • Click the CookieDesk icon and allow the site when Chrome asks
  • Choose Export, then Netscape cookies.txt, and save the file next to where you run yt-dlp
  • Close the incognito window, so that session is never used in the browser again

Run yt-dlp With the File

yt-dlp --cookies cookies.txt "https://www.youtube.com/watch?v=VIDEO_ID"

Give the full path if the file is somewhere else, and keep the quotes around the address so your shell does not trip over the ? and & in it. The same --cookies option works with the other sites yt-dlp supports: export from that site instead.

Keep the File Safe

A cookies.txt file is a live login. Anyone who has it can use your session on that site until it expires, without your password. Keep it out of shared folders, never commit it to a Git repository, and delete it when you are done. CookieDesk warns you before every export for this reason. If you would rather not risk your main account, sign in with a secondary one before exporting.

Troubleshooting

  • yt-dlp says the file is not in Netscape format: the first line should read "# Netscape HTTP Cookie File". Export again as cookies.txt, not JSON
  • Still asked to sign in, or to confirm you are not a bot: cookies expire and YouTube rotates them; export again from a fresh incognito window
  • Some cookies are missing: the Netscape format has no column for partitioned (CHIPS) cookies, so CookieDesk leaves them out and tells you how many
  • Nothing shows up in incognito: "Allow in Incognito" is off for CookieDesk in chrome://extensions

Ways to Give yt-dlp Your Cookies, Compared

Cookie options for yt-dlp with Chrome, November 2026
MethodChrome on WindowsGood to know
--cookies-from-browser chromeOften fails since Chrome 127Usually fine on macOS and Linux
--cookies-from-browser firefoxWorksYou need to sign in to the site in Firefox
--cookies with a file exported by an extension (CookieDesk, Get cookies.txt LOCALLY and others)WorksWorks wherever Chrome runs; the file is a live login, so keep it private

The Short Version

On Windows, skip --cookies-from-browser chrome: export a Netscape cookies.txt from an incognito window with a cookie extension, pass it to yt-dlp with --cookies, and delete it when you are done.

Try CookieDeskView, edit and delete cookies, partitioned ones too
Add to Chrome

More from the blog

All posts →