Chrome will pull bookmarks, passwords and history out of another browser (Chrome Help). Hand it a cookie file and it has nowhere to put it. So to import cookies into Chrome you borrow something with permission to write them: a cookie extension, the Application panel in DevTools, or a script talking to the DevTools protocol. If the file came out of Cookie-Editor, the extension route takes about a minute.

All of this assumes the session is yours. Maybe you exported it from Firefox last night, or it is the QA account your team resets every Monday. Load a stranger's cookies and you are signed in as that stranger.

How to import cookies into Chrome with an extension

  1. From the Chrome Web Store, add Cookie-Editor (any cookie extension with an Import button works the same way).
  2. Open the site the cookies came from, for example https://mail.example.com.
  3. Click the Cookie-Editor icon and press Import.
  4. Paste. JSON, a Netscape cookies.txt and a bare name=value; name2=value2 header string are all accepted.
  5. Confirm and reload.

Step 2 matters for one format only. JSON and Netscape lines carry a domain, and Cookie-Editor writes each cookie there whatever tab is open. A header string carries none, so it lands on the site in front of you.

Still looking at a sign-in form? Check the Application panel (below) before you blame the import.

Netscape files cause most of the trouble. Cookie-Editor tries a paste as JSON first, then as a header string, then as Netscape, and its Netscape reader cuts each line at the tab characters. Anything other than exactly seven pieces is rejected (Cookie-Editor source), and the popup says "The input is not in a valid format." Send a cookies.txt through Slack or paste it into a web form and the tabs often come back as spaces. Every value is still correct; the file still fails. Open it in an editor that shows tab characters, or ask whoever sent it for JSON. The Netscape cookie format, explained has the seven columns in order.

Your profiles, cookies and proxies stay on your computerIn Mosaic: Local first. Profiles, cookies and proxies stay on your computer. Free covers 3 profiles with no card, and Pro is $25 a month for any number of them.

How it works: Local first

One or two cookies need no extension at all. In DevTools, open Application › Storage › Cookies and click the site. Double-click the empty row at the bottom, type the name, Tab, the value, Enter. DevTools fills in domain, path and the rest, and you can double-click any of them except Size to change it (Chrome DevTools docs). A cookie with an invalid value turns red.

A real login is usually twenty or thirty cookies spread over three or four domains, so typing it in is a bad afternoon. The same table is where you confirm what an import really set.

Set cookies from a script

In code, set them before the first goto. Playwright's browserContext.addCookies() wants a url, or a domain and a path, on every cookie; a domain that starts with a dot covers its subdomains too (Playwright docs). Anything else that speaks the DevTools protocol can call Network.setCookie or Network.setCookies directly (CDP Network domain).

An imported cookie has to pass the checks Chrome runs on a Set-Cookie header. Three of them catch old exports. The first two come from MDN's Set-Cookie reference:

  • __Host- cookies must be Secure, must have path /, and must not have a Domain attribute. An exporter that writes .example.com in the domain column breaks every one of them.
  • SameSite=None without Secure is refused.
  • Expired cookies are discarded, by curl as by browsers (curl's cookie notes). Export on the 1st, import on the 20th, and some of the jar is already gone.

Some logins never lived in cookies. If the token sits in local storage, a flawless cookie import still leaves you signed out, because local storage is not part of a cookie import.

Importing cookies into a Mosaic profile

Mosaic profiles run on Tesseract Chrome, our own Chromium, and the import box is in the profile editor.

  1. Open the profile and click its Cookies tab.
  2. Paste into Paste an export: a JSON array from Cookie-Editor or EditThisCookie, a { "cookies": [...] } wrapper, a Netscape cookies.txt, or a name=value; name=value header.
  3. Press Load cookies, look over the table, save the profile.
Creating a Mosaic profile: proxy, hardware and locale drawn to match its IP
The profile editor, where the Cookies tab lives

We wrote that parser after hitting the failures above. A Netscape line is split on any run of whitespace, so the Slack-mangled file loads. #HttpOnly_ lines are read as HttpOnly cookies, not skipped as comments. Paste a header string and a Domain field appears, with Load cookies greyed out until it is filled; without a domain the cookies would "import" and set nothing. A bad line is named, as in "Line 4 is not a Netscape cookie row."

Under the hood the cookies go in over DevTools, so Chromium stores them the same way it stores cookies from a real sign-in. On Pro the local API does the same job: POST /profiles/:id/cookies pushes them into a running profile with no restart, which is how a Playwright script attached to a profile can begin already signed in. The jar is encrypted on disk and stays on your computer (local first). For the other end of the trip, see how to export cookies from Chrome.