Netscape Cookies to JSON: How to Convert and Import X Cookies

Digital Account Market

· Last updated:

You have a cookies.txt file, and the extension or automation tool you want to use only accepts a JSON cookie array. Converting Netscape cookies to JSON is a small job once you know what each column in the file means, and it takes seconds when you use a converter that tells you exactly which lines it could not read.

This guide explains the Netscape cookie file format, shows what the JSON side looks like, walks through the free conversion tool, and then covers importing the result into a cookie editor and checking that the X session actually works. You will also learn the handful of paste mistakes that cause most failures, and what to do when a tool asks for Base64 instead of JSON.

Netscape cookies to JSON: the seven tab-separated columns

A Netscape cookie file is plain text with one cookie per line. Each line holds seven fields separated by a single tab character, always in the same order. Curl, wget and most browser cookie-export extensions write this layout.

  • Domain: where the cookie applies, for example .x.com. A leading dot means subdomains are included.
  • Subdomain flag: TRUE or FALSE, saying whether subdomains may also receive the cookie.
  • Path: usually just a slash, meaning the whole site.
  • Secure: TRUE if the cookie is only sent over HTTPS.
  • Expiration: a Unix timestamp in seconds. A zero means a session cookie that ends when the browser closes.
  • Name: the cookie name, such as auth_token or ct0.
  • Value: the cookie value itself, which is the secret part.

Two special cases appear often. Lines that start with a hash sign are comments and are ignored, with one exception: a line that begins with the prefix #HttpOnly_ is a real cookie whose domain follows the prefix, marked as HTTP-only. Some exporters also leave the final value empty, so a six-field row is possible and still valid.

The JSON cookie format that extensions expect

JSON cookie imports are normally an array of objects, one object per cookie, with a key for each field. The free converter on this site produces keys named domain, includeSubdomains, path, secure, expires, name, value and httpOnly. It mirrors the seven columns, plus a flag for the HTTP-only prefix.

Be aware that extensions are not perfectly uniform. Browser extension APIs often call the expiry field expirationDate rather than expires, and some add keys such as hostOnly or sameSite. Before you move a large batch, export a single cookie from the extension you plan to import into and compare its key names with the converter output. If the names differ, a quick find-and-replace on the key name usually resolves it.

Convert cookies.txt to JSON with the free tool

The quickest route is the Netscape cookies to JSON tool. It runs in your browser, so the text you paste is not sent to or stored on the server. Treat the content like a password anyway, because cookie values are live session credentials.

  • Paste the whole cookies.txt, including comment lines. You do not need to clean anything first.
  • Read the three counters: valid cookies, bad lines, and skipped lines. Skipped lines are comments and blank rows, which is normal.
  • If bad lines appear, open the list of unreadable lines. Each entry shows the line number and the reason.
  • Copy the JSON list when the valid count matches what you expect.

If you are not sure what kind of file you were given, paste a few lines into the format identifier first. A delivery file with colon-separated account lines is a different thing from a tab-separated cookie file, and our guide to checking a delivered file's structure before using a format tool explains how to tell them apart.

Import the JSON into a cookie editor and verify the session

Once you have the JSON, import it into a cookie editor extension in a browser profile you use for this purpose.

  • Open x.com in that profile first, so the extension has a page and domain to attach the cookies to.
  • Open the extension's import option and paste the JSON array.
  • Reload the page and look for your logged-in home timeline instead of the sign-in screen.

For an X login, the cookies that matter most are auth_token, which carries the session, and ct0, the companion token the site uses for requests. Check that their domain is .x.com (or the older .twitter.com if your export uses it), that the path is a slash, and that the expiration is a date in the future. An expired timestamp is the most common reason an otherwise perfect import fails. If you want the full picture of token-based sign-in, read how to log in to Twitter with an auth token.

Common conversion errors: tabs, #HttpOnly_ lines and comments

Most failures come from a handful of mistakes, and the converter's error list points straight at them.

  • Tabs turned into spaces: copying from a chat window, a word processor or some web pages can replace tab characters with spaces. The tool then sees one long field instead of seven. Copy from the original file in a plain text editor instead.
  • Wrong field count: every row must have six or seven fields. A row with extra spaces inside the value or a missing column is reported with its line number.
  • Empty domain or name: a row with a blank domain or cookie name cannot be used, so the tool lists it instead of guessing.
  • Expiration that is not a number: the fifth field must be digits. A date written as text, or a stray character, is rejected.
  • Comment confusion: lines starting with a hash are skipped, but #HttpOnly_ lines are real cookies. If your count is lower than expected, check that these were not deleted by an earlier cleaning step.

After fixing the source, paste again and compare the valid count with the number of cookies you expected. A converter that reports every unreadable line beats one that quietly drops them.

Converting onward to Base64 when a tool asks for it

Some panels and import forms want the cookie array as a single Base64 string rather than readable JSON. Paste the JSON into the JSON to Base64 tool and choose the compact single-line output unless the destination asks for indentation. To inspect or debug an existing Base64 string, the reverse direction is covered in decoding Base64 cookie data back to JSON.

Keep your original cookies.txt as the source of truth, because JSON and Base64 versions can always be regenerated from it. When you are ready to add accounts to your workflow, browse the aged accounts category, then use the free tools above to prepare whatever format your tool needs.

Frequently asked questions

What is the difference between Netscape and JSON cookie formats?

A Netscape file is plain text with seven tab-separated columns per line. JSON is a structured array where each cookie is an object with named keys. They carry the same information, so converting between them changes the layout, not the cookie data.

Why does my pasted cookies.txt show zero cookies?

Usually the tabs were replaced by spaces during copying, so every line has the wrong number of fields. Copy directly from the original file in a plain text editor and paste again. A file that contains only comments or blank lines also produces zero cookies.

Is a line that starts with #HttpOnly_ a comment or a real cookie?

It is a real cookie. The prefix only marks it as HTTP-only, and the domain starts right after it. Ordinary lines that start with a hash sign are comments and are skipped.

Which cookie fields matter most for an X login?

The name and value of auth_token and ct0 matter most, together with a correct domain such as .x.com, a path of a slash and an expiration date that has not passed. Fields like the subdomain flag rarely cause trouble once those are right.

Can I convert the JSON back to Netscape or Base64 later?

Base64 works in both directions with the JSON to Base64 and Base64 to JSON tools. The site does not offer a JSON-to-Netscape converter, so keep your original cookies.txt if you may need that format again.

Tools

Popular categories

SupportChannel