cookies.txt Converter

Convert Netscape cookie files, JSON and a request Cookie header. Values stay unchanged.

A Cookie header contains no domain, path, expiry, Secure or HttpOnly metadata. Header import creates host-only session cookies using your explicit URL/path/Secure settings, with HttpOnly=false; these are new assumptions, not recovered metadata. Header export filters domain, path, expiry and HTTPS. This utility does not model SameSite, partitioned cookies or public-suffix restrictions and is not a full browser cookie jar. Never share authentication cookies.

Netscape cookie file format: curl documentation

Frequently Asked Questions

What is the Netscape cookies.txt format?

It is the plain-text cookie file format used by curl, wget and many download managers. Each line holds one cookie as seven TAB-separated fields: domain, include-subdomains flag (TRUE/FALSE), path, secure flag (TRUE/FALSE), expiry as a Unix timestamp (0 means a session cookie), name, and value. Lines starting with # are comments.

What does the #HttpOnly_ prefix on a line mean?

HttpOnly cookies cannot be read by browser JavaScript, so the format cannot mark them with a normal field. Instead the domain is prefixed with #HttpOnly_, for example #HttpOnly_.example.com — without the prefix the line would look like a comment. The converter parses these lines as cookies, keeps the flag, and writes the prefix back on export.

How do I convert a cookies.txt file to JSON?

Set the input format to "Netscape cookies.txt" and the output format to JSON, then press Convert. Every line becomes an object with domain, includeSubdomains, path, secure, expires (Unix seconds, 0 for a session cookie), name, value and httpOnly fields — convenient for scripts, tests and automation.

How is a Cookie request header built for a URL?

For the target URL the converter applies the RFC 6265 sending rules: the host must match the cookie domain (subdomains included when the flag is TRUE), the URL path must match the cookie path, Secure cookies are only sent over HTTPS, and already-expired cookies are skipped. Matches are ordered longest path first and joined as name=value pairs separated by "; ".

What happens when I import a Cookie header?

A Cookie header carries only names and values — no domain, path, expiry, Secure or HttpOnly metadata. Import creates host-only session cookies for the host of the target URL, using the path and Secure options you set, with HttpOnly=false. These are new assumptions, not recovered metadata.

How are Secure and expiry handled?

In cookies.txt the fourth field is the Secure flag (TRUE/FALSE); in JSON it is a boolean. When a header is built, Secure cookies are dropped unless the target URL is HTTPS. Expiry is a Unix timestamp in seconds — 0 means a session cookie — and cookies that have already expired are excluded from header output.

Are cookie values decoded, re-signed or refreshed?

No. Values are treated as opaque text and copied verbatim in every conversion; nothing is decoded, re-encoded, decrypted, re-signed or refreshed. If a name or value contains characters a Cookie header cannot carry, header export stops with an error — choose JSON output instead, which preserves such values unchanged.

Does my data leave the browser?

No. Parsing and conversion run entirely in your browser with JavaScript — no upload, no server round-trip. Still, treat cookie files as credentials: never share authentication cookies, and only inspect Cookie headers you are authorized to use.

{-- * External Resources Component(#18 Phase 3b 内容佐证工程) * 工具页「权威引用」区块:RFC / W3C / WHATWG / ECMA / IANA / 官方规范站 / Wikipedia。 * * - 接受 :slug 属性 → 经 config/tool-sources.php 家族矩阵渲染该工具的权威引用 * - slug 未命中映射时不渲染(无权威来源的工具静默跳过) * - 链接 title 保持英文(引用源专名);description 经 * common.resources.descriptions.{key} 本地化,lang 未命中回退英文(线上不裸奔) * - 链接保持 dofollow(rel="noopener noreferrer") * * @param string|null $slug --}}