Is It Safe to Paste a JWT Into an Online Decoder? A 10-Second Check
DEV Community

Is It Safe to Paste a JWT Into an Online Decoder? A 10-Second Check

The payload isn't secret, but the token is. Here is how to decode a JWT without handing your session to a stranger.

You are debugging a login bug. The request fails, you copy the Authorization header, search "JWT decoder online", and paste the token into the first result. It takes five seconds. You have probably done it a hundred times.

Most of the time nothing bad happens. But it is worth knowing exactly what you just did, because a JWT is not just data. It is a credential.

A JWT is readable by design, and that is the trap

A JSON Web Token has three parts separated by dots: a header, a payload and a signature. The first two are only Base64URL-encoded JSON. Anyone can read them, with no key and no secret. That is why decoding a JWT is trivial, and why "the payload isn't secret" is true.

The mistake is stopping there. The token as a whole is a bearer credential: whoever holds it can usually call your API as that user until it expires. A production token with a one-hour lifetime, pasted into a site that logs its inputs, is a one-hour key to your account in someone else's logs.

Two things leak when you paste a real token:

  • The claims. User IDs, emails, roles, tenant IDs and internal service names are common in payloads.
  • The token itself. If it is still valid, it can be replayed.

Where does the token go when you paste it?

It depends entirely on how the decoder is built. Server-side decoders send your token to their backend, decode it there, and send the result back. Your token crossed the network and may be logged, cached or analyzed. Client-side decoders decode the token with JavaScript in your browser. The request never leaves the tab.

Both look identical on screen. You cannot tell by the design of the page, and a sentence like "we never store your data" is a promise, not proof.

The 10-second DevTools check

You do not have to trust anyone. Check it yourself:

  1. Open the decoder page.
  2. Press F12 and open the Network tab.
  3. Click the trash icon to clear the list.
  4. Paste a fictional token into the decoder.
  5. Watch the list.
  6. If no new request appears while the claims are decoded, the page processed the token locally.
  7. If a request fires (often a POST or a GET with the token in the URL or body), your token left your machine.

Use a throwaway token for this test, never a real one. Here is one you can use. It is fictional and its signature is a placeholder:

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1XzQ4MjEiLCJuYW1lIjoiVGVzdCBVc2VyIiwicm9sZSI6ImFkbWluIiwiaWF0IjoxNzY3MjI1NjAwLCJleHAiOjE3NjcyMjkyMDB9.SIGNATURE_PLACEHOLDER

Decoded, it says: subject u_4821, name Test User, role admin, issued at 2026-01-01 00:00:00 UTC, expires one hour later.

One honest limit: "nothing leaves the browser" protects you from the site. It does not protect you from a malicious browser extension or someone with access to your machine.

Or decode it yourself, with no website at all

For a real token, the safest decoder is the one you already have. With Node.js:

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

Run that against the fictional token above and you get:

{ sub: 'u_4821', name: 'Test User', role: 'admin', iat: 1767225600, exp: 1767229200 }

Change [1] to [0] to read the header instead. No network is involved, so nothing can leak.

What to look at once it is decoded

Reading the claims is only useful if you know what to check. These four catch most real bugs:

  • exp: is it in the past? Clock skew between servers causes a surprising number of "random" 401s.
  • iat and nbf: a token that is "not yet valid" usually means two machines disagree about the time.
  • aud and iss: a token issued for another API or another environment is rejected by a correct server.
  • alg in the header: it must match what your server expects. A mismatch is a classic cause of "invalid signature".

Decoding is not verifying

This is the other half of the lesson. A decoder shows you what the token claims. It does not prove the token is genuine. Anyone can craft a token that decodes cleanly and says "role": "admin". Only a signature check on your server, with your key, proves it was issued by you and not modified.

And never paste your signing secret into a website to "verify" a token. If a tool asks for the secret, make sure it runs locally. Better, verify in your own code.

A simple rule

  • Throwaway or test token: any decoder is fine.
  • Real or production token: use a decoder that runs fully in the browser (confirm with the Network tab), or decode it locally with a script.
  • Anything that grants admin access: do not paste it anywhere. Rotate it if you already did.

If you want a decoder that does everything in the browser, I run one at jwtsecretkey.com/jwt-decoder. It shows the header, the claims with human-readable dates, and whether the token is active or expired, and you can confirm with the Network tab that nothing is sent. For a step-by-step explanation of each segment, see How to Decode a JWT.

Have you ever pasted a production token somewhere you regretted? Tell me what you do now in the comments.

Read on DEV Community ↗ ← Back to News

Comments

No comments yet. Start the discussion.