Local JavaScript debugging tool

JavaScript Cookie Parser

Paste a document.cookie string, a Cookie: request header or one or more Set-Cookie: response headers. Decode values, inspect attributes and copy structured JSON without uploading session data.

Cookie: session_id=abc123; theme=dark

Set-Cookie: session_id=abc123; Path=/; HttpOnly; SameSite=Lax
Cookie and Set-Cookie formats

Parse JavaScript cookies and HTTP headers

Choose the format you copied from DevTools. Cookie mode accepts document.cookie and request headers; Set-Cookie mode reads one response header per line and keeps attributes separate.

Paste a Cookie header or document.cookie string and click Parse cookies.

How to use it

Parse cookies copied from JavaScript or DevTools

1. Copy the right value

For JavaScript-visible cookies, run copy(document.cookie) in the browser console. For network debugging, copy the Cookie request header or individual Set-Cookie response headers.

2. Choose the matching format

Use Cookie mode for semicolon-separated name-value pairs. Use Set-Cookie mode for one response header per line when attributes such as Path, Domain, Secure, HttpOnly and SameSite matter.

3. Review and copy JSON

Compare raw and decoded values, check parsed attributes, then copy JSON into a bug report, test fixture or local debugging session. Remove live tokens before sharing.

Know the formats

Cookie header vs. Set-Cookie header

document.cookie and Cookie:

These contain the cookies JavaScript can read or the browser sends with a request: name=value; theme=dark. They do not include Path, Domain, expiry or security flags. HttpOnly cookies never appear in document.cookie.

Set-Cookie:

A server sends one cookie definition per response header. The first name-value pair is followed by attributes such as Path=/, Max-Age=3600, Secure, HttpOnly and SameSite=Lax.

Encoded JavaScript values

Applications often store JSON or spaces with encodeURIComponent. This parser preserves the raw value and shows a readable decoded version. Invalid percent escapes remain unchanged instead of breaking the parse.

Practical examples

JavaScript cookie parsing examples

Read cookies visible to JavaScript:

const cookieString = document.cookie;
// Example: "session=abc123; theme=dark"

Copy a Cookie header from a request: open DevTools → Network → select a request → Request Headers. Use Set-Cookie mode for response headers. Browsers may expose multiple Set-Cookie lines separately.

Security note: a missing HttpOnly cookie is expected in JavaScript. HttpOnly prevents page scripts from reading the value and helps reduce token theft during cross-site scripting attacks.

FAQ

JavaScript cookie parser questions

What can I paste into this JavaScript cookie parser?

Paste a raw document.cookie string, a complete Cookie: request header, or one or more Set-Cookie: response headers. Select Set-Cookie mode when you need attributes.

Why are HttpOnly cookies missing from document.cookie?

Browsers intentionally hide HttpOnly cookies from JavaScript. Inspect the browser Application or Storage panel, or copy the Set-Cookie response header, to review them.

Are percent-encoded cookie values decoded?

Yes. The raw value is retained and a decoded value is shown when it can be decoded safely. Values containing extra equals signs are preserved.

Is pasted cookie data uploaded?

No. Parsing and JSON generation happen locally in your browser. Cookie values may contain active session credentials, so redact them before sharing copied JSON or screenshots.

Related developer tools

JSON Stringify

Stringify, escape, unstringify or format JSON copied from a cookie value.

JSON Diff

Compare decoded cookie payloads or API responses path by path.

JSONL Viewer

Inspect newline-delimited JSON logs exported from debugging tools.