Decode JWT headers and payloads, check expiry, and verify HS, RS, PS, ES and EdDSA signatures with a secret or public key, with warnings for risky settings.
Input
Result
Paste a token and its contents will appear here.
Tokens and keys are processed only in this browser and never sent anywhere. Still, avoid pasting production secrets.
Related searches
jwt decoder
decode jwt token
decode jwt token online
jwt decoder online
jwt decoder tool
online jwt decoder
What is JWT Decoder & Verifier?
Decodes and shows the header and payload of a JWT. Use it to check what information a login token holds.
How to use
1
Paste the token.
2
Check the header and payload.
3
Check the expiry time (exp) and other fields.
Tips
Tokens from real services are sensitive. This tool processes them only inside your browser, but do not paste them in public places.
Frequently asked questions
QCan it also check whether the JWT signature is valid?
Yes. When you paste a token, an input field appears depending on the header's alg. Enter a secret key for HS256, HS384 and HS512, or a public key (PEM or JWK) for the RS, PS, ES families and EdDSA, and it tells you whether the signature matches. If the secret key is Base64, turn on the checkbox.
QHow can I tell whether a token has expired?
If the payload has exp (expiry time), the 'Time info' section unpacks the date and time, and based on now it tells you whether the token is 'already expired' or 'still valid', along with how many hours from now or days ago. It also shows iat (issued at) and nbf (not valid before).
QI get the error 'A JWT must be three parts separated by dots'.
A JWT is text made of three parts, header.payload.signature, joined by dots (.). Check whether the start or end was cut off when you pasted it, or whether text such as 'Bearer ' came along with it. If it has three parts but still can't be read, you'll get a hint to check whether the token was cut off in the middle.
Learn more
1What does a JWT look like?
A JWT consists of three chunks joined by dots (.): header.payload.signature. The first two are JSON written in base64url (using - and _ instead of + and /, and without the trailing =). For example, decoding the header eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9 gives {"alg":"HS256","typ":"JWT"}.
The payload is not encrypted, only encoded. Anyone who has the token can read its contents, so do not put sensitive information such as passwords or national ID numbers in it.
2Expiry and standard claims
Commonly seen claims are iss (issuer), sub (subject), aud (audience), exp (expiry), nbf (not valid before this time), iat (issued at) and jti (identifier). exp, nbf and iat are written as Unix timestamps (in seconds). This tool converts exp into a human-readable time and tells you whether the token has expired.
If clocks are off, the expiry judgment can change, so the server's and the client's clocks need to be nearly in sync. Servers usually allow a tolerance of a few tens of seconds.
3Signature verification and risky settings
The signature is the part that checks that the content was not changed on the way. With the HS family, such as HS256, the issuer and the verifier use the same secret key, while the RS, PS, ES and EdDSA families sign with a private key and verify with a public key. This tool verifies the signature when you enter a secret key or public key.
Tokens whose alg is none, or settings that let verification pass with an algorithm different from the one the server expects, can be abused for forgery, so the tool warns about them. Do not share real production tokens outside; check them in a place like this tool that processes them only inside your browser.
4What's the difference between decoding and verifying a JWT?
Decoding means reading what's inside the token, while verifying means checking with the signature that the contents are genuine. They are completely different operations.
The header and payload aren't encrypted; they're just JSON encoded in Base64URL, so anyone can unpack them. That's why you can see the contents the moment you paste in a token.
Verification means recomputing whether the signature part was made with the right key. Even a single changed character in the content makes the signature fail.
Even if a decoded result looks plausible, don't trust it until you've checked the signature. Enter a key in this tool's signature field to see the verification result right away.
5I pasted a token and it says it can't be parsed
The most common cause is a truncated token or extra characters before or after it. This tool expects exactly three parts separated by dots (.).
If you copied it from an Authorization header, leave out the leading 'Bearer ' and the space, and paste starting from the part that usually begins with eyJ.
Check that 'Bearer ' isn't attached at the front.
Check that no quotes, line breaks or spaces got mixed into the middle.
If you copied from a log, check that the long token wasn't shortened with an ellipsis.
A token with five parts is an encrypted JWE format, so its contents can't be read.
Even with three parts, if the middle is cut off it can't be read as JSON and an error appears.
6How do you read the exp number as a date?
exp, iat and nbf are the number of seconds since 00:00 on January 1, 1970 (UTC). The key point is that it's seconds, not milliseconds.
For example, an exp of 1700000000 is 22:13:20 UTC on November 14, 2023. In Korean time (KST, UTC+9), adding 9 hours gives 7:13:20 a.m. on November 15, 2023.
JavaScript's Date.now() is in milliseconds, so when comparing you need to divide by 1000 or multiply exp by 1000. If you pass exp directly to new Date(), you get around January 20, 1970, and the token looks already expired.
900
Validity period
15 minutes
3600
Validity period
1 hour
86400
Validity period
1 day
2592000
Validity period
30 days
exp - iat value
Validity period
900
15 minutes
3600
1 hour
86400
1 day
2592000
30 days
7What's the difference between HS256 and RS256?
HS256 signs and verifies with a single secret key, while RS256 signs with a private key and verifies with a public key.
The HS family is simple, but the verifying side holds the same secret key, so anyone who knows the key can forge tokens. It fits well when one server both issues and verifies.
Asymmetric methods such as RS, PS, ES and EdDSA can't be forged even if the public key leaks, so they're widely used when several services verify tokens issued in one place.
HS256/384/512
Key used to sign
Secret key
Key used to verify
The same secret key
Notes
Simple and fast
RS256/384/512
Key used to sign
RSA private key
Key used to verify
RSA public key
Notes
Most widely used
PS256/384/512
Key used to sign
RSA private key
Key used to verify
RSA public key
Notes
RSA-PSS method
ES256/384/512
Key used to sign
Elliptic-curve private key
Key used to verify
Elliptic-curve public key
Notes
Short keys and signatures
EdDSA
Key used to sign
Ed25519 private key
Key used to verify
Ed25519 public key
Notes
Fast and compact
Algorithm
Key used to sign
Key used to verify
Notes
HS256/384/512
Secret key
The same secret key
Simple and fast
RS256/384/512
RSA private key
RSA public key
Most widely used
PS256/384/512
RSA private key
RSA public key
RSA-PSS method
ES256/384/512
Elliptic-curve private key
Elliptic-curve public key
Short keys and signatures
EdDSA
Ed25519 private key
Ed25519 public key
Fast and compact
8What to check when signature verification keeps failing
If it says the signature doesn't match, either the key is different or the token's contents were changed. Most of the time it's because the wrong key was entered.
In particular, some services store the secret key as a Base64 string. In that case the server signs with the decoded bytes, so you need to turn on the Base64 checkbox in this tool to get the same result.
Check that no spaces or line breaks are attached before or after the secret key.
Check that the header's alg value matches the type of key you entered (secret or public).
A public key must be in BEGIN PUBLIC KEY format or a JWK. Entering a private key or a certificate shows a guidance message.
The BEGIN RSA PUBLIC KEY format isn't supported, so convert it to SPKI format.
Check that you haven't mixed keys from different environments (development, production).
9What is the kid header and why is it there?
kid is the label (key ID) of the key that signed this token. Services that rotate keys regularly use it to pick which key to verify with.
Authentication services usually publish a list of public keys as JSON at an address called JWKS. The verifying side finds the entry matching the token's kid and checks the signature with that key. In this tool, paste that one key from the list in JWK form.
kid is a value the sender of the token can write freely. The server should only look it up within its list of allowed keys, and using kid directly in a file path or query is dangerous.
10What information should you not put in a JWT?
Anyone can read the payload, so the rule is not to put in values that must stay secret.
This tool also warns if the payload has fields named like a password, card or national ID number (in Korea, the resident registration number). Keep in mind that tokens can also be left behind in logs, browser history and proxy servers.
Better left out: passwords, card numbers, national ID numbers, internal system addresses.
Include with care: personal data such as email, phone number and real name.
Fine to include: user ID (sub), role, issuer (iss), expiry time (exp).
Roles and permissions can be included, but know that changed permissions don't take effect until the token expires.
A longer token can hit header size limits, so include only what's truly needed.
11Why are there separate access tokens and refresh tokens?
The design gives the frequently used access token a short life and the refresh token, used to get a new one, a long life, to limit the damage of a leak.
Even if an access token leaks, it has little time to be abused if it's close to expiring. If refresh tokens are recorded on the server, they can be revoked when there's a problem.
Lifetimes depend on the service's security policy, so there's no set number. Access tokens range from minutes to about a day, and refresh tokens from several days to dozens of days.
12Where is it safest to store a JWT?
There's no single right answer; it depends on which attacks you want to guard against more. The typical choices are localStorage and an HttpOnly cookie.
localStorage
Advantage
Easy to implement and convenient to attach directly to API requests
Caveats
If a script is planted through XSS, it can read the token
HttpOnly cookie
Advantage
JavaScript can't read it, reducing XSS damage
Caveats
Needs CSRF protection (SameSite, tokens) and the Secure flag is essential
Memory (a variable)
Advantage
Disappears on refresh, so exposure is limited
Caveats
Needs a flow that re-issues the token after every refresh
Storage location
Advantage
Caveats
localStorage
Easy to implement and convenient to attach directly to API requests
If a script is planted through XSS, it can read the token
HttpOnly cookie
JavaScript can't read it, reducing XSS damage
Needs CSRF protection (SameSite, tokens) and the Secure flag is essential
Memory (a variable)
Disappears on refresh, so exposure is limited
Needs a flow that re-issues the token after every refresh
13Why are logout and revocation hard with JWTs?
JWTs are designed so the server doesn't have to remember state, so it's hard for the server to invalidate one at will before it expires.
That's why you keep access token lifetimes short and, if needed, keep a revocation list on the server. A common approach is to put a jti (unique ID) in the token and store the IDs of revoked ones.
On logout, deleting the token on the client isn't enough. You have to revoke the refresh token on the server so it can't be used to get a new token.
14It says expired, but the server says it's valid
JWT times are absolute moments independent of time zone, so only the displayed time differs, and the expiry decision itself is the same. Differences usually come from clock error in the reference clock.
This tool shows expiry based on the clock of the device you're using. Even a few minutes of drift can make a token close to expiring look different.
If servers' clocks drift apart, a freshly issued token can be rejected as not yet valid (nbf).
Many libraries can be set to allow a leeway of a few dozen seconds.
First check that your device's clock is set to sync automatically.
15What do errors like jwt malformed and invalid signature mean?
The error messages libraries produce vary slightly, but the causes boil down to a few. Reading the message to decide where to look first saves time.
jwt malformed
Meaning
Not the three dot-separated parts format
Check first
Whether the token was cut off or Bearer is attached
invalid signature
Meaning
The signature doesn't match the key
Check first
Whether the key, algorithm and environment (dev/prod) match
jwt expired
Meaning
The exp time has passed
Check first
Issue time, the server clock, the re-issue flow
jwt not active
Meaning
Used before the nbf time
Check first
Server clock drift, calling right after issue
invalid audience / issuer
Meaning
aud or iss differs from the expected value
Check first
The config values of the service receiving the token
Error message (example)
Meaning
Check first
jwt malformed
Not the three dot-separated parts format
Whether the token was cut off or Bearer is attached
invalid signature
The signature doesn't match the key
Whether the key, algorithm and environment (dev/prod) match
jwt expired
The exp time has passed
Issue time, the server clock, the re-issue flow
jwt not active
Used before the nbf time
Server clock drift, calling right after issue
invalid audience / issuer
aud or iss differs from the expected value
The config values of the service receiving the token
If you open the header and payload in this tool first, you can spot most of the causes above by eye.
16How do JWTs differ from session cookies?
With sessions, the server remembers the login state; with JWTs, the token itself carries the information. Neither is simply better; they suit different uses.
State storage
Session cookie
The server (or a store) remembers it
JWT
The token carries the data, so no server storage is needed
Immediate logout
Session cookie
Delete the session and it's over
JWT
Hard to revoke before expiry
Multiple servers/services
Session cookie
Needs a shared session store
JWT
Only the signature needs verifying, so it scales easily
Request size
Session cookie
Small, just a session ID
JWT
Relatively larger since it holds data
Aspect
Session cookie
JWT
State storage
The server (or a store) remembers it
The token carries the data, so no server storage is needed
Immediate logout
Delete the session and it's over
Hard to revoke before expiry
Multiple servers/services
Needs a shared session store
Only the signature needs verifying, so it scales easily
Request size
Small, just a session ID
Relatively larger since it holds data
17What should you keep in mind when inspecting production tokens?
A token is as sensitive as a password, so get into the habit of leaving it nowhere once you've finished checking.
This tool handles tokens and keys only inside your browser and never sends them to a server. Even so, avoid putting a production token that hasn't expired yet on a shared screen or in a chat window.
When posting a token in a question or issue, delete the signature part (the last part).
Avoid pasting production secret or private keys; verify with the public key instead.
Issue debugging tokens from a test account with a short expiry.
If a token has been exposed, don't wait for it to expire; revoke it on the server or rotate the key.