SCANNER TECHSJASSI SINGH
← Blog

Is jwt.io Safe? Decode a JWT Without Sending It Anywhere

For a dev or expired token, jwt.io is fine. For a live production token, decode it somewhere that never sees it. A JWT’s header and payload are Base64URL-encoded JSON that anyone can read without the secret, so jq, Python, Node or a browser decoder that runs entirely in the tab will show you everything. Never paste a signing secret into any website.

You have a JWT from a failing request and want to see what’s inside it. The habit is to paste it into jwt.io. Whether that’s safe is less about jwt.io than about what the token is and where it came from. This post covers what a JWT contains, why you don’t need the secret to read it, and how to decode one on your own machine, with a shell, Node or Python, or with the browser JWT decoder I make.

I’m not going to tell you jwt.io does anything bad with your tokens. I have no evidence of that. The point is narrower: you can’t audit a page you don’t control, so for a live production token the safe default is to decode it somewhere that has no reason to see it.

What a JWT actually contains

RFC 7519 defines a JWT as “a compact, URL-safe means of representing claims to be transferred between two parties”. In the common signed form it’s three parts separated by dots, which jwt.io’s own introduction writes as xxxxx.yyyyy.zzzzz:

  1. Header: which algorithm signed it (alg) and the token type (typ).
  2. Payload: the claims, such as who the token is about (sub), who issued it (iss), and when it expires (exp).
  3. Signature: proof that the first two parts haven’t been changed.

The header and payload are Base64URL-encoded JSON. Encoding isn’t encryption. jwt.io’s introduction says it directly: in a signed token the information “is readable by anyone”, it’s protected against tampering, not against reading, and you shouldn’t put secret data in the payload or header unless it’s encrypted. The RFC adds that a JWT “may contain privacy-sensitive information”, which in practice means user IDs, email addresses, roles and tenant names.

Decoding vs verifying

These are different jobs, and mixing them up is where most of the confusion comes from.

  • Decoding turns the header and payload back into JSON. It needs nothing but the token. No secret, no key.
  • Verifying checks the signature against the issuer’s secret or public key, which proves the token is genuine and unmodified.

So “decode a JWT without the secret” isn’t a trick. It’s how the format works. Anyone who has the token can read it. Only someone with the key can tell whether it’s real.

Decoding without verification is fine for debugging: what’s the exp, which audience is this for, why is the API saying I lack a scope? It’s never fine for making an access decision. Your server must verify.

The real risk of pasting a live token

Most JWTs you’ll handle are access tokens sent as Authorization: Bearer .... RFC 6750 defines a bearer token as one where any party in possession of it can use it in any way that any other party in possession of it can. There’s no proof of a key involved. Whoever holds the string is you, as far as the API is concerned, until the token expires.

The same RFC tells implementers to limit token lifetime, notes that short-lived tokens (one hour or less) reduce the damage if one leaks, and warns against putting bearer tokens in page URLs because they can be stolen “from the history data, logs, or other unsecured locations”. Tokens are treated as secrets that leak through ordinary plumbing.

So pasting a live production token into any third-party web page is handing a working credential to code you didn’t write and can’t see the next version of. The page may well decode it in your browser and send nothing. You’d still be trusting that, rather than knowing it. For an expired token, or one from your local dev environment, the stakes are much lower.

Decode a JWT locally

Each of these reads the payload without the secret and without the network. I tested all three on macOS against a token I built myself, including one whose payload contains - and _ characters and needs padding. Those are the two things that break naive one-liners.

Put the token in a variable first, so it doesn’t end up in your shell history as part of a long command:

read -r TOKEN   # paste, then Enter

jq

echo "$TOKEN" | jq -R 'split(".")[1] | gsub("-";"+") | gsub("_";"/") | @base64d | fromjson'

Change [1] to [0] for the header. To see the expiry as a date, append | .exp | todate. The two gsub calls matter: Base64URL uses - and _ where plain Base64 uses + and /, and without them jq refused my test token as “not valid base64 data”.

Plain shell, and why I don’t recommend it

The usual answer is cut -d. -f2 | tr '_-' '/+' | base64 -d. On macOS it exits successfully but silently drops the end of the payload when the padding is missing. In my test the closing } was gone. You can add the = padding back by hand, but jq or Python is less fragile.

Python

python3 -c 'import sys,base64,json; p=sys.argv[1].split(".")[1]; print(json.loads(base64.urlsafe_b64decode(p + "=" * (-len(p) % 4))))' "$TOKEN"

urlsafe_b64decode handles - and _, and the "=" * (-len(p) % 4) puts back the padding JWTs strip off.

Node

node -e 'const p=process.argv[1].split(".")[1]; console.log(JSON.parse(Buffer.from(p,"base64url").toString()))' "$TOKEN"

Node’s base64url encoding takes care of both the alphabet and the padding.

How to check that a web decoder stays local

If you’d rather use a page, you can check one yourself instead of trusting its claims, mine included:

  1. Open the decoder and let it finish loading.
  2. Open DevTools, go to the Network tab, and clear it.
  3. Paste a token. A token from a dev environment or an expired one is fine for this.
  4. Watch for any new request. A decoder that works locally makes none.
  5. For a second check, switch DevTools’ throttling to Offline, or turn off Wi-Fi, and paste again. If it still decodes, the decoding happens in the page.

This is a check on what you can see today. It isn’t a guarantee about the next deploy, which is why the command line stays the safest option for production tokens.

Where my JWT decoder fits

The JWT decoder is one of the 88 browser tools on Scanner Techs Tools. It splits the token into its three parts and colours each one, pretty-prints the header and payload, shows sub, iss, aud, iat, nbf and exp as readable dates with “in 3 days” style times, and gives the token a status: Valid, Expired, Not Yet Valid or No expiry.

What it doesn’t do matters as much:

  • It doesn’t verify signatures. It never asks for a secret or key. “Valid” means only that the current time is between nbf and exp. It says nothing about whether the token is genuine.
  • It makes no network requests with your token. The decoding is plain JavaScript in the page, and the page loads no analytics. You can confirm that with the DevTools steps above. Once the page has loaded it keeps decoding with the network off.
  • It doesn’t work offline from a cold start. The page has to load once first. There’s no service worker installing it for later.

Alternatives, fairly

  • jwt.io decodes, verifies a signature if you give it the secret or key, and can generate tokens. Verification is a real feature my decoder doesn’t have. Just don’t paste a production signing secret into any web page.
  • The command line (jq, Python or Node above) is the most auditable option, and uses tools you may already have.
  • Your own code: if you’re debugging an app, the JWT library it already uses can decode the token, and verify it with the key your server has, without anything leaving your machine.

My rule of thumb: dev and expired tokens go wherever is convenient. Live production tokens get decoded in a terminal or in a page I’ve watched in the Network tab. Never paste a signing secret into a website.

If a browser tab is what you want, the JWT decoder is free with no sign-up, alongside the other tools at tools.scannertechs.com.

The app

Scanner Techs ToolsFreeBrowserBrowser-native dev utilities. Nothing leaves the tab.