What is a JWT?
A JSON Web Token (JWT, often pronounced “jot”) is a compact way to pass signed information between systems. It is widely used for logins and APIs: after you sign in, a server gives your app a token, and the app sends it with each request, usually as Authorization: Bearer <token>.
A JWT has three parts separated by dots, each Base64URL-encoded:
- Header: the token type and the signing algorithm, such as
HS256orRS256. - Payload: the claims, statements about the user and the token, like who it is for and when it expires.
- Signature: proof that the header and payload were created by someone with the right key and have not been changed.
How to use this decoder
- Paste a token into the box. The header and payload are decoded straight away.
- Check the status message to see whether the token has expired or is not valid yet.
- Read Claims explained for a description of each claim, with dates in your local time.
- To check the signature, paste the secret (for
HSalgorithms) or the issuer’s public key (forRS,PS,ESandEdDSA) and press Verify signature.
The example token is signed with HS256 and the secret niftykit-example-secret, so you can try verification.
Supported keys and algorithms
| Algorithms | Key to paste |
|---|---|
| HS256, HS384, HS512 | The shared secret, as text or Base64 |
| RS256, RS384, RS512, PS256, PS384, PS512 | RSA public key: PEM (BEGIN PUBLIC KEY), JWK or JWK Set |
| ES256, ES384, ES512 | Elliptic curve public key: PEM, JWK or JWK Set |
| EdDSA (Ed25519) | Ed25519 public key: PEM or JWK, in browsers that support Ed25519 |
Many identity providers publish their public keys as a JWK Set at a URL like/.well-known/jwks.json. Paste the whole set and the key matching the token’s kid is used.
The tool uses the algorithm named in the token, but it will not use a public key as an HMAC secret. A token that claims HS256 while you have the issuer’s public key is a classic forgery, known as algorithm confusion, and your own code should refuse it too by fixing the expected algorithm rather than trusting the header.
Limitations
- Encrypted tokens (JWE) cannot be decrypted; only their header is shown.
- X.509 certificates and PKCS#1 (
BEGIN RSA PUBLIC KEY) keys must be converted to a standard public key first. The error message shows the command to use. - Time claims are compared with your device’s clock, so a wrong clock gives a wrong expiry status.
Frequently asked questions
Is it safe to paste a real token here?
Decoding and verification happen entirely in your browser. The token, secret and key are never sent to NiftyKit or anyone else. Even so, treat live tokens like passwords: anyone who has an unexpired token can usually use it, so avoid pasting them into tools you do not trust, and prefer expired or test tokens where you can.
Does decoding a JWT mean it is valid?
No. The header and payload are only Base64URL-encoded, not encrypted, so anyone can read them. A token is only trustworthy if its signature is valid for the issuer’s key and its time claims (exp, nbf) are acceptable. Your server must check both, plus the issuer (iss) and audience (aud).
Why can’t I see the contents of my token?
If the token has five parts instead of three, it is an encrypted JWT (JWE). Only the header can be read without the private key. Some services also use opaque access tokens that are random strings rather than JWTs; those cannot be decoded at all.
What does “alg: none” mean?
The token is not signed, so anyone could have created or changed it. Servers should reject unsigned tokens unless they have a very specific reason not to. Accepting them has caused serious security vulnerabilities.
