How to export Chrome cookies to JSON

TL;DR: To export Chrome cookies to JSON, install CookieVault Editor, click Export, and choose JSON (or Netscape cookies.txt for curl/wget). Chrome DevTools does not have a built-in export feature. For automated exports in CI/CD, use Puppeteer’s page.cookies() or Playwright’s context.cookies().

Exporting Chrome cookies to JSON is the process of serializing the browser’s cookie store into a structured file that can be backed up, shared, imported into another browser profile, or fed to command-line tools like curl and wget. Chrome’s DevTools Application panel lets you view and edit cookies but does not offer an export button — a Manifest V3 extension or a headless browser script is required for structured export1. This guide covers three methods in order of practicality for different workflows.

Quick comparison: export methods

In short: Use a Manifest V3 extension for interactive one-click exports. Use Puppeteer or Playwright for automated exports in CI/CD pipelines. Use the DevTools console for quick one-off grabs when you cannot install an extension, keeping in mind that HttpOnly cookies will be missing.

MethodExports HttpOnly cookiesOutput formatAutomation supportRequires extension
CookieVault Editor (extension)YesJSON, Netscape, HARNo (manual click)Yes
Puppeteer page.cookies()YesJSON (via JSON.stringify)Yes (scriptable, CI-ready)No (headless Chrome)
Playwright context.cookies()YesJSON (via JSON.stringify)Yes (scriptable, CI-ready)No (headless Chromium)
DevTools console document.cookieNo (misses HttpOnly)Raw string (manual parsing)NoNo
HAR export via DevTools NetworkPartial (in request headers)HARNoNo

According to the Chrome DevTools documentation, the Application panel’s cookie table is designed for inspection and editing, not for data export1. The Network panel can export full request archives as HAR files that include cookie headers, but extracting individual cookies from HAR requires post-processing.

In short: CookieVault Editor exports cookies from a toolbar popup in three formats — JSON for structured data, Netscape cookies.txt for curl/wget, and HAR for full request archives. One click per export, including HttpOnly cookies.

The eight-step export workflow:

  1. Decide which cookies to export — determine whether you need a single-domain export (e.g., staging.example.com) or a full browser export. Single-domain exports are smaller and safer to share; full exports capture your entire session state.
  2. Choose an export format — JSON for programmatic use and re-import. Netscape cookies.txt for curl -b and wget --load-cookies. HAR for full request archives including headers and response bodies.
  3. Install CookieVault Editor — install from the Chrome Web Store. The extension requests the cookies permission to access the full cookie store, including HttpOnly cookies.
  4. Open the extension popup — click the CookieVault Editor toolbar icon. The popup shows all cookies for the current domain. Click “All cookies” to see every cookie in the browser.
  5. Click Export — the format picker appears. Select JSON, Netscape cookies.txt, or HAR.
  6. Save the file — Chrome opens a file-save dialog. Choose a location and filename.
  7. Verify the export — open the file in a text editor or JSON viewer. Confirm that the expected cookies are present and that HttpOnly cookies are included.
  8. Use the exported file — feed it to your downstream tool: curl -b cookies.txt, Playwright’s context.addCookies(), or CookieVault Editor’s Import function for cross-profile session transfer.

Important: Exported cookie files contain authentication tokens. Treat them like passwords — do not commit them to version control, do not share them over unencrypted channels, and delete them when no longer needed.

Method 2: Puppeteer or Playwright (automated)

In short: For CI/CD pipelines, test fixture generation, and scripted workflows, Puppeteer’s page.cookies() and Playwright’s context.cookies() return the cookie array as JSON. Both include HttpOnly cookies. Write the output to a file with JSON.stringify.

A minimal Puppeteer export script:

const puppeteer = require('puppeteer');
const fs = require('fs');

(async () => {
  const browser = await puppeteer.launch();
  const page = await browser.newPage();
  await page.goto('https://example.com');
  // Authenticate if needed (page.type, page.click, etc.)
  const cookies = await page.cookies();
  fs.writeFileSync('cookies.json', JSON.stringify(cookies, null, 2));
  await browser.close();
})();

The equivalent Playwright approach:

const { chromium } = require('playwright');
const fs = require('fs');

(async () => {
  const browser = await chromium.launch();
  const context = await browser.newContext();
  const page = await context.newPage();
  await page.goto('https://example.com');
  const cookies = await context.cookies();
  fs.writeFileSync('cookies.json', JSON.stringify(cookies, null, 2));
  await browser.close();
})();

Both methods return an array of cookie objects with typed fields: name, value, domain, path, expires (Unix timestamp), httpOnly, secure, sameSite. The output is directly compatible with context.addCookies() for re-import.

Method 3: DevTools console (limited)

In short: Running document.cookie in the DevTools console returns a semicolon-separated string of cookie name=value pairs for the current domain. This method is fast but incomplete — HttpOnly cookies are excluded and metadata (expiry, flags, path) is lost.

The document.cookie approach works as a quick fallback when you cannot install an extension:

  1. Open DevTools (F12) → Console tab
  2. Type document.cookie and press Enter
  3. Copy the output string
  4. Parse manually or use a script to split on ; and then on =

This method has three significant limitations:

For anything beyond a quick sanity check, use Method 1 or Method 2.

Export format reference

In short: JSON and Netscape are the two most common export formats. JSON preserves all metadata and is re-importable. Netscape is a legacy format designed for curl/wget compatibility. HAR is a full-request archive that includes cookies as part of the HTTP headers.

JSON format

[
  {
    "name": "session_id",
    "value": "abc123def456",
    "domain": ".example.com",
    "path": "/",
    "expires": 1756252800,
    "httpOnly": true,
    "secure": true,
    "sameSite": "Lax"
  }
]

JSON advantages:

Netscape cookies.txt format

# Netscape HTTP Cookie File
.example.com	TRUE	/	TRUE	1756252800	session_id	abc123def456

Each line has seven tab-separated fields: domain, include subdomains (TRUE/FALSE), path, secure (TRUE/FALSE), expiry (Unix timestamp), name, value.

Netscape advantages:

When to use which format

Use caseRecommended format
Backup and restore across browser profilesJSON
Feed cookies to curl or wgetNetscape cookies.txt
Share test fixtures with QA teamJSON
Archive full request/response for debuggingHAR
Automate in CI/CD with Puppeteer/PlaywrightJSON
Import into Postman or InsomniaJSON (via collection import)

Security considerations for exported cookies

In short: Cookie export files are credential-equivalent artifacts. A leaked session cookie file gives anyone full access to your authenticated sessions. Handle them with the same care as passwords and API keys.

Six security rules for handling exported cookie files:

These precautions apply equally to JSON, Netscape, and HAR formats — all three contain the raw cookie values that authenticate your sessions.

See also


Footnotes

  1. Chrome’s official DevTools documentation for cookie inspection and editing is at https://developer.chrome.com/docs/devtools/storage/cookies. The Application panel displays cookies in a table with inline editing but does not include an export function. The Network panel’s HAR export includes cookies as part of request headers but requires post-processing to extract individual cookie records. 2