plain/devtools home

Decode a JWT without the secret key

You do not need the secret to read a JWT. The header and payload are base64url encoded JSON, not encrypted. The secret is only needed to verify the signature, which proves the token was not changed.

Last reviewed 2026-11-04.

jwt-decodersampless sample · c copy
■ Header
■ Payload

This tool decodes only. It does not check the signature, so a decoded token is not proof the token is genuine.

never leaves your browser

Worked example

A JWT is three parts joined by dots: header.payload.signature. Take the first part of the sample token:

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9 decodes to {"alg":"HS256","typ":"JWT"}.

The second part decodes the same way into the claims such as sub, iat and exp. Use the "HS256 sample (expired)" sample in the decoder above to see all three parts.

Decode in code

JavaScript (Node.js)

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

Python

import base64, json
p = token.split('.')[1]
p += '=' * (-len(p) % 4)
payload = json.loads(base64.urlsafe_b64decode(p))

Shell

echo "$TOKEN" | cut -d. -f2 | tr '_-' '/+' | base64 -d

The shell version may print a padding warning; the JSON is still shown.

What the secret is for

The signature is a hash or signature over the header and payload. Only a holder of the key can create a valid one, and your server recomputes it to check. Anyone can read a token; no one without the key can forge one.

Never put secrets in a payload for that reason. Also watch for tokens whose header says "alg":"none"; they carry no signature and must be rejected.

Running this on a server

Verification runs on your server with the key. If you are standing up a small API, the hosting guide compares where to run it.

Frequently asked questions

Is a JWT encrypted?

A standard signed JWT (JWS) is not. Encrypted tokens (JWE) are a different format with five parts.

Can the decoder check the signature?

No. Verification needs the secret or public key and belongs on your server.

Why not decode on a third party site?

A token can grant access. Use a decoder that runs in your browser and sends nothing, like the one above.

Sources

Related

esc
↑↓ move↵ open? all shortcuts

Keyboard shortcuts

Cmd or Ctrl shortcuts always work.
Everywhere
Everywhere
Open the command palette
CtrlK
Open the palette (outside a text field)
/
Show these shortcuts
?
Toggle light and dark theme
t
Go home
gh
Go to all tools
gt
On a tool page
On a tool page
Run the main action
Ctrl↵
Copy the output
c
Load the next sample
s
Focus the input
i
Leave a text field
Esc
Previous or next tool
[]
In the palette
In the palette
Move the selection
↑↓
Open the selected item
↵
Close
Esc