The three parts
A JWT has the shape header.payload.signature. Each part is encoded with Base64URL, a variant of Base64 that is safe to put in URLs. Here is a small example with the signature left out:
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkFzaGEiLCJpYXQiOjE3MDAwMDAwMDAsImV4cCI6MTcwMDAwMzYwMH0.<signature>
Decoding the first part gives {"alg":"HS256","typ":"JWT"}: the algorithm used to sign the token. Decoding the second gives the payload: {"sub":"1234567890","name":"Asha","iat":1700000000,"exp":1700003600}. The third part is the cryptographic signature and is not JSON.
The payload is encoded, not encrypted
This is the point people miss. Anyone who holds the token can decode and read the header and payload; no key is needed. Base64URL is just a way of writing bytes as text. Therefore a standard signed JWT must never contain secrets such as passwords, card numbers or private personal data.
There is a separate standard, JWE, which encrypts the contents, but it is much less common. If you see a three-part token, assume the payload is readable.
Signed does not mean secret. A signature proves the token was not changed. It does not hide what is inside.
What the signature protects
The server signs the header and payload with a secret key (HS256) or a private key (RS256, ES256). Later, when the token comes back, the server recomputes the signature. If someone changed even one character of the payload, the signature will not match and the token is rejected.
So the signature gives integrity and authenticity: the data came from the issuer and has not been altered. It is the verifying step on the server, not the decoding step, that makes a token trustworthy. Decoding alone proves nothing.
Common claims
| Claim | Meaning | Example |
|---|---|---|
| iss | Who issued the token | https://auth.example.com |
| sub | The subject, usually a user id | 1234567890 |
| aud | Who the token is intended for | my-api |
| exp | Expiry time as a Unix timestamp | 1700003600 = 2023-11-14 23:13:20 UTC |
| iat | When it was issued | 1700000000 = 2023-11-14 22:13:20 UTC |
| nbf | Not valid before this time | a Unix timestamp |
Reading a token safely
- Decode tokens in a tool that runs in your browser and does not send them to a server. A live token is a credential until it expires.
- Prefer using expired or test tokens when you share a token with someone or paste it into an issue tracker.
- Check exp and iat as timestamps. The example token above lasted exactly one hour (3,600 seconds).
- Remember that decoding a token tells you what it claims, not whether it is valid. Only the issuing server or a library with the right key can verify it.
Mistakes developers make with JWTs
- Trusting a token without verifying its signature, or accepting the "none" algorithm.
- Storing sensitive data in the payload.
- Using very long expiry times. A stolen token works until it expires, so keep access tokens short-lived and refresh them.
- Storing tokens where scripts can read them without considering cross-site scripting. Choose storage deliberately, for example an HTTP-only cookie.
- Not planning for revocation. Because a JWT is self-contained, it stays valid until it expires unless the server keeps a deny list.
Frequently asked questions
Is a JWT encrypted?
A standard signed JWT is not encrypted. The payload can be read by anyone with the token. Only the signature stops it being modified without detection.
Can I trust the data in a decoded JWT?
Only after the signature has been verified with the correct key and the claims, such as expiry and audience, have been checked. Decoding by itself proves nothing.
How is Base64URL different from Base64?
Base64URL replaces + and / with - and _ and usually drops the = padding, so the result is safe to use in URLs and file names.
What does HS256 versus RS256 mean?
HS256 uses one shared secret to sign and verify. RS256 uses a private key to sign and a public key to verify, so many services can verify tokens without being able to create them.
Try these tools
JWT Decoder
Decode a JWT to read its header, payload and expiry time. Free and runs locally, so your token is never sent to a server.
Open toolBase64 Encode & Decode
Encode text to Base64 or decode Base64 back to text. Supports UTF-8 and URL-safe Base64. Free, instant and runs in your browser.
Open toolUnix Timestamp Converter
Convert Unix timestamps (seconds or milliseconds) to human-readable dates and back. Shows UTC, ISO 8601 and local time. Live current epoch.
Open toolHash Generator (SHA-256)
Generate SHA-1, SHA-256, SHA-384 and SHA-512 hashes for text or files. Verify downloads and checksums. Runs locally in your browser.
Open toolKeep reading
How to verify web design files
How to verify web design files before you accept, publish or hand them off: check they arrived intact, nothing is missing, the code is valid, images are right and the build matches the design.
Read guideUnix timestamps explained: seconds, milliseconds and the Year 2038 problem
Learn what a Unix timestamp is, how to tell seconds from milliseconds, how to convert one to a human date, why time zones matter, and what the Year 2038 problem is.
Read guideBase64 explained: how it works, with examples
Understand Base64 encoding with worked examples ("Man" becomes TWFu), why it makes data 33% bigger, what the = padding means, and why Base64 is not encryption.
Read guide