Developer Tools

Is It Safe to Decode a JWT Online?

By · Published

Decoding a JWT online is safe if the tool decodes it inside your browser and the token is a test token or already expired. The risk isn't the decoding, which anyone can do; it's handing a live token to a website that might log it. A valid JWT works like a password until it expires. Here's how to tell whether a decoder keeps your token local, what to look for once it's decoded, and how to decode one without any website at all.

Short version: use a decoder that runs locally, such as our JWT Decoder, confirm it with the Network tab, prefer expired or test tokens, and never paste a production signing secret anywhere.

Is a JWT encrypted?

Almost never. A normal JWT is signed, not encrypted. Its header and payload are JSON written in base64url, which is just a way of encoding text, so anyone holding the token can read every claim in it: user ID, email, roles, expiry. The signature only proves the contents haven't been changed. That's why you should never put passwords or other secrets inside a JWT payload. Encrypted tokens do exist (JWE, with five dot-separated parts instead of three), but they're much rarer.

What's the actual risk of pasting a token into a website?

Whoever receives a live token can use it. Most APIs accept a JWT as a "bearer" token: whoever bears it is treated as the user, with no further check, until it expires. If a decoder site sends your token to its server and keeps it in a log, anyone with access to that log can call your API as you until the token runs out. Access tokens often last 5 minutes to an hour; refresh tokens can last weeks.

The decoding itself leaks nothing extra. The question is only whether the token leaves your device.

How can I check that a decoder keeps my token local?

  1. Open the decoder page, then press F12 and click the Network tab.
  2. Clear the list, then paste a token.
  3. If no new request appears, the decoding happened in your browser. A request carrying your token, often a POST to the site's own API, means it was sent away.
  4. For extra certainty, turn off Wi-Fi after the page has loaded and paste again. A local decoder still works.

Our JWT Decoder passes this test: decoding and signature checks use the browser's built-in Web Crypto, and the token is never sent anywhere.

Does decoding a JWT tell me it's genuine?

No. Decoding only reads it. To show the difference, we took a token signed with HS256, changed its role claim from "admin" to "superadmin" and re-encoded it. It decoded perfectly, and looked completely normal. Only verifying it with the secret revealed the problem: "Invalid signature". Any code that reads claims from a token without verifying it first can be fooled this way.

Token we testedDecodes?Verifies?
Signed with HS256, correct secretYesYes
Same token, wrong secretYesNo
Same token, one claim editedYesNo
Signed with RS256, PS256, ES256 and ES384, matching public keysYesYes
alg set to "none", no signatureYesNothing to verify: reject it

What should I check once a token is decoded?

  • exp, iat and nbf are in seconds, not milliseconds. A classic bug is comparing exp with JavaScript's Date.now(), which is in milliseconds, so every token looks valid forever. Divide by 1,000 first.
  • Clock skew. If a fresh token is rejected as "not valid yet", the server's clock may be behind the issuer's. Most libraries allow a small leeway, often around a minute.
  • aud and iss. A token issued for one app (its audience) shouldn't be accepted by another, even if the signature is valid.
  • alg. Your server should decide which algorithm it expects and refuse anything else, rather than trusting the alg in the header. Accepting "none", or accepting HS256 where RS256 is expected, are well-known ways tokens get forged.

How do I decode a JWT without any website?

In Node.js, one line:

JSON.parse(Buffer.from(token.split('.')[1], 'base64url').toString('utf8'))

In a browser console, avoid the popular atob() one-liner if the token might contain non-English text. atob returns raw bytes as characters, so names in Urdu, Arabic or with accents come out garbled. Our test token contained اردو ٹیسٹ, and the atob version mangled it. This version decodes UTF-8 properly:

const p = token.split('.')[1].replace(/-/g, '+').replace(/_/g, '/');
const bytes = Uint8Array.from(atob(p), c => c.charCodeAt(0));
JSON.parse(new TextDecoder().decode(bytes));

To read the exp value as a date, paste it into the Unix Timestamp Converter.

Questions people ask

Is jwt.io safe to use?

Run the Network-tab check above on any decoder you use, jwt.io included, and decide for yourself. Whatever the site, the same rule applies: prefer test or expired tokens, and never paste a production signing secret.

Can someone change my JWT and use it?

They can change it, but a server that verifies signatures will reject the changed token, as our edited-claim test showed. They can't create a valid new signature without the secret or private key.

What should I do if I pasted a live token somewhere I don't trust?

Log out, or revoke the session in the app, so a new token is issued. If it was a long-lived refresh token or an API key, rotate it.

Where should a web app store a JWT?

That's a trade-off with no single answer. HttpOnly cookies keep the token away from JavaScript (and from XSS attacks) but need CSRF protection; localStorage is simpler but readable by any script on the page. Keeping access tokens short-lived limits the damage either way.