Decoded Waiting for a token
Signature Not checked
Claims Not checked

Encoded token

    Verify signature

    Use test secrets and test keys only. Never paste a production signing secret or a private key into any website, including this one.

    A matching signature proves who signed the token. It does not mean the token should be accepted: the expiry, issuer and audience must be checked too.

    Header

     

    Payload

     

    Signature

     

    Ctrl+Enter run / or Ctrl+K search tools Press Ctrl+D to bookmark this page

    How to decode a JWT

    1. Paste the token into the Encoded token box. A Bearer prefix, an Authorization: header name, quotes and line breaks are removed for you, and the tool lists what it removed.
    2. The header and payload appear at once as formatted JSON, and the Claims table shows every claim with its meaning, its value and, for times, the local date, the UTC date and how long ago or from now that is.
    3. To check the signature, paste the shared secret (for HS256) or the issuer's public key as PEM, JWK or JWKS (for RS, PS, ES and EdDSA) into Verify signature. Add the issuer and audience you expect to compare them as well.

    The three results at the top are kept apart on purpose: Decoded means the token could be read, Signature says whether it matches your key, and Claims says whether its times and expected values pass. Only all three together tell you a token is good.

    What a JWT is

    A JSON Web Token is a compact way to pass signed facts between systems, such as "this request comes from user 12345 and may read orders until 10:00". It is three pieces of Base64URL text joined by dots: header.payload.signature.

    • Header: JSON that names the signing algorithm (alg) and often a key ID (kid).
    • Payload: JSON with the claims, the facts the token states.
    • Signature: made from the first two parts with a secret or a private key, so any change to them is detected.

    The header and payload are only encoded, not encrypted. Anyone who has a token can read it, which is exactly what this page does. A token with five parts is a JWE, an encrypted token, and only its header can be read without the recipient's key.

    Decoding is not verifying

    Decoding shows what a token says. It proves nothing: anyone can write a token with any claims. Before a server trusts a token, it must check all of these:

    1. The signature matches a key the server already trusts.
    2. The algorithm is one the server expects for that key, never simply whatever the header says.
    3. exp is in the future and nbf, if present, is in the past.
    4. iss is the expected issuer and aud includes the server itself.

    A token can have a perfectly valid signature and still be expired, or be meant for a different service. A matching signature also does not mean the user is allowed to do what they are asking: that is up to the application.

    How verification works here. The key you paste decides which algorithms are allowed: a secret only verifies HS tokens, an RSA key only RS and PS, and each EC curve only its own ES algorithm. If the token's header names an algorithm that does not fit the key, the check is refused and explained instead of attempted. This blocks the "algorithm confusion" trick, where a token claims HS256 so that a public key gets used as an HMAC secret. ECDSA signatures must be in the raw format JWTs use; a DER-encoded signature is recognised and reported.

    Registered claims

    ClaimNameMeaning
    issIssuerWho created the token. Compare it with the exact issuer you trust.
    subSubjectWho the token is about, usually a user or service ID.
    audAudienceWhich service should accept it. One string or a list.
    expExpiration timeSeconds since 1970 (UTC). Reject the token at or after this time.
    nbfNot beforeSeconds since 1970 (UTC). Reject the token before this time.
    iatIssued atSeconds since 1970 (UTC). When the token was created.
    jtiJWT IDA unique ID, used to block replays or revoke one token.

    Times are NumericDate values: whole seconds since 1 January 1970 UTC, not milliseconds. A value with 13 digits, such as 1795564800000, was almost certainly written in milliseconds by mistake, and the tool warns about it. Everything else in a payload, such as scope, roles or email, is defined by the issuer.

    Signing algorithms

    algMethodNotes
    HS256, HS384, HS512HMAC with SHA-2One shared secret signs and verifies. Simple, but every verifier can also create tokens.
    RS256, RS384, RS512RSA PKCS#1 v1.5A private key signs, a public key verifies. The most widely supported choice.
    PS256, PS384, PS512RSA-PSSLike RS, with a more modern padding scheme.
    ES256, ES384, ES512ECDSA (P-256, P-384, P-521)Public-key signatures with much smaller keys and tokens than RSA.
    EdDSAEd25519Fast, modern public-key signatures. Verified here where your browser supports it.
    noneNo signatureAn unsigned token. Never accept it.

    An HMAC secret should be at least as long as the hash: 32 random bytes for HS256. Short or guessable secrets can be cracked offline from a single token, without contacting the server.

    Warnings the tool shows

    Errors (in red) mean the token cannot be read at all, and say exactly why: the wrong number of parts, a character that is not Base64URL, an impossible length, or a header that is not JSON, with its position. Warnings mean the token was read but something needs attention:

    • alg: none: the token is not signed and must never be accepted.
    • No expiry: a leaked token without exp works forever.
    • Long lifetime: more than 30 days between issue and expiry.
    • Sensitive-looking data: keys such as password or api_key in a payload anyone can read.
    • Key URLs or keys in the header (jku, x5u, jwk): a server must not take its verification key from the token itself.
    • Duplicate keys, string or millisecond times, and an issue time in the future, which libraries handle differently.

    Notes are information only, for example that HS256 relies on a shared secret.

    Safety: tokens, secrets and this page

    A live token is a credential: whoever holds it can use it until it expires. That is why many developers are rightly wary of pasting tokens into websites. On this page, decoding and verification run entirely in your browser with its built-in Web Crypto API. Nothing you paste is sent to a server, saved in your browser, or put in a link, and the page never fetches keys from the internet.

    You do not have to take our word for it. Open your browser's developer tools, choose the Network tab, then paste a token and a key: no request is made. You can also load the page, disconnect from the network, and keep using it.

    Even so, prefer test tokens and test keys, and let real tokens expire. Never paste a production signing secret or a private key into any website. Verifying never needs a private key, and the tool refuses one if you paste it.

    Frequently asked questions

    Is my token sent to a server?

    No. Decoding and signature checks run in your browser with its built-in Web Crypto API. The token, secret and key are never uploaded, saved or put in a link, and the page never fetches keys. You can confirm it in your browser's Network tab.

    Can I decode a JWT without the secret?

    Yes. The header and payload are only Base64URL-encoded, so anyone can read them without a key. The secret or public key is needed only to check that the signature is genuine.

    Does decoding mean the token is valid?

    No. Decoding shows what a token claims. It is valid only if the signature matches a trusted key, the algorithm is the one you expect, it has not expired, and the issuer and audience are right. The tool shows each of these separately.

    Why does it say the signature matches but the token is expired?

    The signature only proves who made the token and that it was not changed. Expiry is a separate check on the exp claim. A correctly signed token stops being valid once its exp time has passed.

    What do the times in exp, iat and nbf mean?

    They are seconds since 1 January 1970 UTC. The tool shows each one in your time zone, in UTC, and as a relative time such as "expired 3 days ago" or "valid for 2 hours more".

    Which algorithms can it verify?

    HS256, HS384 and HS512 with a shared secret; RS256 to RS512 and PS256 to PS512 with an RSA public key; ES256, ES384 and ES512 with an EC public key; and EdDSA (Ed25519) where your browser supports it. Keys can be PEM, JWK or a JWKS.

    Why is my key rejected for this token?

    The key decides which algorithms may be used. A secret only checks HS tokens, an RSA key only RS and PS, and each EC curve only one ES algorithm. Accepting an HS token with a public key would allow forged tokens, so the tool refuses.

    Can it read encrypted tokens (JWE)?

    It recognises a five-part encrypted token and shows its header, but it cannot read the claims, because that needs the recipient's private key. Decryption is not supported.

    Decode and verify a JWT in your code

    Splitting a token, decoding the header and payload, checking an HS256 signature in constant time, and reading exp, in Java, JavaScript, Python and Go using only each standard library. In production, use a maintained JWT library that also checks the algorithm, issuer and audience.

    Java

    // Decode a JWT and check its HS256 signature with the standard library.
    import java.nio.charset.StandardCharsets;
    import java.security.MessageDigest;
    import java.time.Instant;
    import java.util.Base64;
    import java.util.regex.Matcher;
    import java.util.regex.Pattern;
    import javax.crypto.Mac;
    import javax.crypto.spec.SecretKeySpec;
    
    public class JwtDecode {
        public static void main(String[] args) throws Exception {
            String token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJodHRwczovL2F1dGguZXhhbXBsZS5jb20iLCJzdWIiOiJ1c2VyXzEyMzQ1IiwiYXVkIjoiYXBpLmV4YW1wbGUuY29tIiwiaWF0IjoxNzk1MTY4ODAwLCJleHAiOjE3OTUzNDE2MDB9.kmmPgCGxdVqHUfxO1J2t3afGfzq46xqdkl0j-HbMi6g";
            // A test secret, never a real one.
            byte[] secret = "demo-secret-for-testing-only-0001".getBytes(StandardCharsets.UTF_8);
    
            String[] parts = token.split("\\.", -1);
            if (parts.length != 3) {
                throw new IllegalArgumentException("Not a JWT: expected 3 parts, found " + parts.length);
            }
    
            // Decoding needs no key. The URL decoder reads Base64URL, with or without padding.
            Base64.Decoder b64url = Base64.getUrlDecoder();
            String header = new String(b64url.decode(parts[0]), StandardCharsets.UTF_8);
            String payload = new String(b64url.decode(parts[1]), StandardCharsets.UTF_8);
            System.out.println("header: " + header);
            System.out.println("payload: " + payload);
    
            // Verifying needs the key. MessageDigest.isEqual compares in constant time.
            Mac mac = Mac.getInstance("HmacSHA256");
            mac.init(new SecretKeySpec(secret, "HmacSHA256"));
            byte[] expected = mac.doFinal((parts[0] + "." + parts[1]).getBytes(StandardCharsets.US_ASCII));
            boolean valid = MessageDigest.isEqual(expected, b64url.decode(parts[2]));
            System.out.println("signature valid: " + valid);
    
            // A good signature is not enough: check the claims too. exp is in seconds.
            // The JDK has no JSON parser; real code would read claims with Jackson or Gson.
            Matcher exp = Pattern.compile("\"exp\"\\s*:\\s*(\\d+)").matcher(payload);
            long expSeconds = exp.find() ? Long.parseLong(exp.group(1)) : Long.MAX_VALUE;
            System.out.println("expired: " + (Instant.now().getEpochSecond() >= expSeconds));
        }
    }

    Standard library only. The JDK has no JSON parser, so real code reads claims with Jackson or Gson, or uses a JWT library such as jjwt or nimbus-jose-jwt.

    JavaScript

    // Decode a JWT and check its HS256 signature with Node's standard library.
    import { createHmac, timingSafeEqual } from 'node:crypto';
    
    const token = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJodHRwczovL2F1dGguZXhhbXBsZS5jb20iLCJzdWIiOiJ1c2VyXzEyMzQ1IiwiYXVkIjoiYXBpLmV4YW1wbGUuY29tIiwiaWF0IjoxNzk1MTY4ODAwLCJleHAiOjE3OTUzNDE2MDB9.kmmPgCGxdVqHUfxO1J2t3afGfzq46xqdkl0j-HbMi6g';
    const secret = 'demo-secret-for-testing-only-0001'; // a test secret, never a real one
    
    const [header, payload, signature] = token.split('.');
    
    // Decoding needs no key: each part is Base64URL-encoded JSON.
    console.log('header:', Buffer.from(header, 'base64url').toString('utf8'));
    const claimsText = Buffer.from(payload, 'base64url').toString('utf8');
    console.log('payload:', claimsText);
    
    // Verifying needs the key. Compare in constant time.
    const expected = createHmac('sha256', secret).update(`${header}.${payload}`).digest();
    const given = Buffer.from(signature, 'base64url');
    console.log('signature valid:', given.length === expected.length && timingSafeEqual(given, expected));
    
    // A good signature is not enough: check the claims too. exp is in seconds.
    const claims = JSON.parse(claimsText);
    console.log('expired:', Date.now() / 1000 >= claims.exp);

    Node.js 16 or later (base64url support). In a browser, use atob and the Web Crypto API.

    Python

    # Decode a JWT and check its HS256 signature with the standard library.
    import base64
    import hashlib
    import hmac
    import json
    import time
    
    token = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJodHRwczovL2F1dGguZXhhbXBsZS5jb20iLCJzdWIiOiJ1c2VyXzEyMzQ1IiwiYXVkIjoiYXBpLmV4YW1wbGUuY29tIiwiaWF0IjoxNzk1MTY4ODAwLCJleHAiOjE3OTUzNDE2MDB9.kmmPgCGxdVqHUfxO1J2t3afGfzq46xqdkl0j-HbMi6g'
    secret = b'demo-secret-for-testing-only-0001'  # a test secret, never a real one
    
    
    def b64url_decode(part: str) -> bytes:
        # JWTs drop the "=" padding; add it back before decoding.
        return base64.urlsafe_b64decode(part + '=' * (-len(part) % 4))
    
    
    header, payload, signature = token.split('.')
    
    # Decoding needs no key: each part is Base64URL-encoded JSON.
    print('header:', b64url_decode(header).decode('utf-8'))
    claims_text = b64url_decode(payload).decode('utf-8')
    print('payload:', claims_text)
    
    # Verifying needs the key. compare_digest compares in constant time.
    expected = hmac.new(secret, f'{header}.{payload}'.encode('ascii'), hashlib.sha256).digest()
    valid = hmac.compare_digest(expected, b64url_decode(signature))
    print('signature valid:', str(valid).lower())
    
    # A good signature is not enough: check the claims too. exp is in seconds.
    claims = json.loads(claims_text)
    print('expired:', str(time.time() >= claims['exp']).lower())

    Standard library only. PyJWT does decoding, verifying and claim checks in one call.

    Go

    // Decode a JWT and check its HS256 signature with the standard library.
    package main
    
    import (
    	"crypto/hmac"
    	"crypto/sha256"
    	"encoding/base64"
    	"encoding/json"
    	"fmt"
    	"strings"
    	"time"
    )
    
    func main() {
    	token := "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJodHRwczovL2F1dGguZXhhbXBsZS5jb20iLCJzdWIiOiJ1c2VyXzEyMzQ1IiwiYXVkIjoiYXBpLmV4YW1wbGUuY29tIiwiaWF0IjoxNzk1MTY4ODAwLCJleHAiOjE3OTUzNDE2MDB9.kmmPgCGxdVqHUfxO1J2t3afGfzq46xqdkl0j-HbMi6g"
    	secret := []byte("demo-secret-for-testing-only-0001") // a test secret, never a real one
    
    	parts := strings.Split(token, ".")
    	if len(parts) != 3 {
    		fmt.Println("not a JWT: expected 3 parts, found", len(parts))
    		return
    	}
    
    	// RawURLEncoding is Base64URL without "=" padding, as JWTs use it.
    	decoded := make([][]byte, 3)
    	for i, part := range parts {
    		b, err := base64.RawURLEncoding.DecodeString(part)
    		if err != nil {
    			fmt.Printf("part %d is not Base64URL: %v\n", i+1, err)
    			return
    		}
    		decoded[i] = b
    	}
    
    	// Decoding needs no key: each part is Base64URL-encoded JSON.
    	fmt.Println("header:", string(decoded[0]))
    	fmt.Println("payload:", string(decoded[1]))
    
    	// Verifying needs the key. hmac.Equal compares in constant time.
    	mac := hmac.New(sha256.New, secret)
    	mac.Write([]byte(parts[0] + "." + parts[1]))
    	fmt.Println("signature valid:", hmac.Equal(decoded[2], mac.Sum(nil)))
    
    	// A good signature is not enough: check the claims too. exp is in seconds.
    	var claims struct {
    		Exp int64 `json:"exp"`
    	}
    	if err := json.Unmarshal(decoded[1], &claims); err != nil {
    		fmt.Println("payload is not JSON:", err)
    		return
    	}
    	fmt.Println("expired:", time.Now().Unix() >= claims.Exp)
    }

    Standard library only. golang-jwt/jwt is the common library for full validation.

    Last verified . Each example is run automatically and its output checked.

    Settings

    Deletes everything this site keeps in your browser: saved inputs, favorites, theme, accent color and tool options.