Export cookies.txt for yt-dlp
Use your own login with yt-dlp, without giving your cookies to an extension you can't check.
yt-dlp is a free command-line tool that downloads videos. Some videos only play when you're logged in, and yt-dlp isn't. So you give it your browser's cookies in a file called cookies.txt, and it uses them to act as your logged-in browser.
That file can sign someone in as you, so the tool that makes it matters. A well-known cookies.txt extension was removed from the Chrome Web Store in 2023 for sending people's cookies to a server. cookieZ makes no network requests, and its code is public, so you can check that yourself.
“Failed to decrypt with DPAPI” on Windows
yt-dlp can usually read cookies straight from your browser with --cookies-from-browser chrome. On Windows, Chrome now encrypts its cookies so that only Chrome itself can read them, and yt-dlp stops with Failed to decrypt with DPAPI. While Chrome is open, it can also say Could not copy Chrome cookie database.
yt-dlp's developers expect this to stay broken on Windows. Their advice is to export your cookies with an extension and give yt-dlp the file with --cookies, which is what the steps below do.
Make the file
- Log in to the site in Chrome.
- Click the cookieZ icon on that site. The first time, it asks for access to websites.
- Under the delete options, choose This domain and its subdomains. Nothing is deleted: export uses the same choice.
- Click Export and choose cookies.txt.
- Click Download and save the file somewhere private. cookieZ names it after the site and the date, such as
cookies-www.youtube.com-2026-11-02.txt.
Use it with yt-dlp
Pass the file with --cookies, using its full name and where you saved it:
yt-dlp --cookies "C:\Users\you\Downloads\cookies-www.youtube.com-2026-11-02.txt" "VIDEO_ADDRESS"
Check the name and the folder. If yt-dlp can't find the file, it doesn't say so. It carries on without your login and makes a new file with that name. If a site still asks you to sign in, this is the first thing to check.
YouTube: make the file in a private window
YouTube keeps changing the login cookies in any YouTube tab you have open, so a file made in your normal window soon stops working. yt-dlp's own guide says to make it in a private window instead, then close that window so the login is never used in the browser again:
- Type
chrome://extensionsinto the address bar, click Details under cookieZ and turn on Allow in incognito. cookieZ doesn't open in incognito windows until you do. - Close any incognito windows you have open, then open a new one and sign in to YouTube.
- In the same tab, type
youtube.com/robots.txtinto the address bar. - Click the cookieZ icon and choose This domain and its subdomains. Nothing is deleted. Click Export, choose cookies.txt and click Download.
- Close the incognito window. Don't sign out first: that would end the login in the file too.
cookieZ keeps incognito cookies apart from your normal ones, so the file holds only the private window's login. yt-dlp's guide also warns that using your account with yt-dlp can get it banned, for a while or for good.
Keep it safe
- Treat the file like a password. Anyone who has it can sign in as you until the login expires.
- Don't paste it into a website, a chat or a bug report.
- yt-dlp updates the file when it finishes, so it stays a login file after use. Delete it when you've finished. To end the login completely, sign out of the site.
- If you need to send it somewhere, cookieZ can lock an export with a password, but yt-dlp can't read a locked file until it's unlocked in cookieZ.
If it doesn't work
Check the file's name and folder first. Logins also expire, and some sites change their login cookies often, so make a new file and try again. For YouTube, make it in a private window, as above. Some sites also tie a login to your browser, and they may refuse it from another program. YouTube can also ask your account to pass its own age check, and cookies can't get round that.
Only use this with your own account, and for things you're allowed to download. A site's terms may not allow it. cookieZ has no link with yt-dlp.
Guides: Clear cookies for one site · Fix “Cookie Too Large” · Block cookies on one site · Block third-party cookies · Export cookies from Chrome · Cookies set before you accept