DevFormatter

JWT Decoder

 

JWT Decoder is a free browser-based tool that decodes JSON Web Tokens (JWTs) and displays the header, payload claims, and signature in readable JSON. It automatically detects expired tokens using the exp claim, supports HS256, RS256, and ES256 tokens, and runs entirely in your browser — your token is never sent to any server.

JWT Decoder

How it works

Last updated: November 2026

A JWT (JSON Web Token) is a compact token format consisting of three Base64URL-encoded parts separated by dots: header, payload, and signature. The header describes the algorithm used; the payload contains claims like user ID, roles, and expiry; the signature proves the token was issued by a trusted party.

Paste any JWT into the left panel and click Decode (or paste — it decodes automatically). The right panel shows the header and payload as formatted JSON, plus the raw signature string. If the token contains an exp claim, the tool checks whether it has expired and shows a warning in the status bar.

All decoding runs in your browser using the built-in atob() and TextDecoder APIs. The token is never sent to any server. Note: decoding reads the payload but does not verify the signature — never trust decoded claims without server-side verification.

JWT Structure & Standard Claims

Claim Name Description
subSubjectUser ID or principal the token represents
issIssuerService that issued the token
audAudienceIntended recipient(s) of the token
expExpirationUnix timestamp after which the token is invalid
iatIssued AtUnix timestamp when the token was issued
nbfNot BeforeToken must not be accepted before this timestamp
jtiJWT IDUnique identifier — prevents replay attacks

Common signing algorithms

Algorithm Type Use case
HS256HMAC shared secretSingle-service auth; secret known to issuer and verifier
RS256RSA public/private keyDistributed systems; verifiers only need the public key
ES256ECDSA public/private keyLike RS256 but with shorter signatures

Tips & Tricks

Decoding ≠ trusting — always verify server-side

Anyone can decode a JWT payload — it's just Base64URL. The signature proves it came from a trusted issuer, but only if you verify it with the correct key. Never authorise actions based on decoded claims without server-side signature verification.

Convert exp to a readable date

The exp and iat claims are Unix timestamps (seconds, not milliseconds). To convert in JavaScript: new Date(payload.exp * 1000).toISOString(). In Python: datetime.fromtimestamp(payload['exp']).

The "none" algorithm is dangerous

Some older JWT libraries accept {"alg":"none"} tokens with no signature, allowing anyone to forge claims. Always explicitly reject alg: none in your verifier. Modern libraries (jsonwebtoken v9+, PyJWT v2+) reject it by default.

Payload is readable — don't store secrets in it

The JWT payload is Base64URL-encoded, not encrypted. Any party with the token can read all claims. Never put passwords, PII, or sensitive business data in a JWT payload. Use JWE (JSON Web Encryption) if you need the payload to be confidential.

Check aud to prevent token misuse across services

If your token contains an aud (audience) claim, your verifier must check that the token was issued for your service specifically. Skipping audience validation lets tokens issued for service A be replayed against service B.

Short expiry + refresh tokens beats long-lived JWTs

JWTs can't be revoked before they expire (without a blocklist). Using short exp (5–15 minutes) plus a refresh token flow limits the damage window if a token is stolen. Long-lived JWTs (days/weeks) are a security risk if not stored carefully.

Code Examples

Node.js

const [headerB64, payloadB64] = token.split('.');

function base64UrlDecode(str) {
  const base64 = str.replace(/-/g, '+').replace(/_/g, '/');
  const pad = base64.length % 4;
  const padded = pad === 2 ? base64 + '==' : pad === 3 ? base64 + '=' : base64;
  return JSON.parse(Buffer.from(padded, 'base64').toString('utf8'));
}

const header  = base64UrlDecode(headerB64);
const payload = base64UrlDecode(payloadB64);
console.log(header, payload);

// With jsonwebtoken library (also verifies signature):
// const decoded = jwt.decode(token, { complete: true });

Python

import base64, json

def decode_jwt_part(part):
    # Add padding
    pad = len(part) % 4
    part += '=' * (4 - pad) if pad else ''
    decoded = base64.urlsafe_b64decode(part)
    return json.loads(decoded)

header, payload, signature = token.split('.')
print(decode_jwt_part(header))
print(decode_jwt_part(payload))

# With PyJWT library (also verifies signature):
# import jwt
# decoded = jwt.decode(token, options={"verify_signature": False})

CLI

# Decode JWT payload with jq and base64
echo "eyJzdWIiOiIxMjM0NTY3ODkwIn0" | base64 -d | jq .

# Full JWT: decode all 3 parts
TOKEN="eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxMjM0NTY3ODkwIn0.signature"
echo $TOKEN | cut -d. -f1 | base64 -d 2>/dev/null | jq . # header
echo $TOKEN | cut -d. -f2 | base64 -d 2>/dev/null | jq . # payload

# With jwt-cli (npm install -g jwt-cli):
jwt decode $TOKEN

Frequently Asked Questions

What is a JWT?
A JWT (JSON Web Token) is a compact, URL-safe token format defined in RFC 7519. It consists of three dot-separated Base64URL-encoded parts: a header (declaring the signing algorithm and token type), a payload (containing claims such as user ID, roles, and expiry), and a signature that proves the token was issued by a trusted party and has not been tampered with. The header and payload are plain JSON — anyone can read them by decoding the Base64URL sections. JWTs are widely used for stateless authentication in REST APIs and single-page applications because the server does not need to store session state: all necessary identity information travels inside the token itself. Libraries such as jsonwebtoken (Node.js), PyJWT (Python), and golang-jwt/jwt (Go) handle creation and verification. Auth providers like Auth0, Firebase, AWS Cognito, and Supabase issue JWTs as access tokens.
What does decoding a JWT reveal?
Decoding a JWT reveals the header (which signing algorithm was used — such as HS256, RS256, or ES256 — and the token type, usually "JWT") and all payload claims. Standard claims you will typically find include sub (the subject — usually a user ID), iss (the issuer — the auth service that created it), aud (the intended audience), exp (expiration timestamp in Unix seconds), iat (issued-at timestamp), and any custom claims the application adds — such as roles, email, or org_id. Decoding does NOT verify the signature — it simply Base64URL-decodes the header and payload bytes and parses them as JSON. Anyone who obtains a JWT can decode and read its claims without any key. Verifying the signature — which requires the shared secret for HS256 or the issuer's public key for RS256/ES256 — is what establishes trust and must happen on the server.
Is it safe to decode a JWT in this tool?
Yes — this tool decodes the JWT entirely in your browser using JavaScript's built-in atob() and TextDecoder APIs; nothing is sent to any server. You can verify this yourself by opening the browser's Network tab in DevTools — no outbound requests are made when you paste and decode a token. That said, as a general security practice, avoid pasting production tokens that contain real user data, session credentials, or sensitive claims into any online tool you do not fully trust. For debugging auth flows, it is safer to use a development or staging token with a fake or expired subject. Tokens containing sensitive personal data (names, email addresses, internal user IDs) are subject to data protection regulations in some jurisdictions, so treating them with the same care as passwords is prudent. This tool stores nothing — no localStorage, no cookies, no analytics beyond anonymous page-view counts.
What is the difference between decoding and verifying a JWT?
Decoding simply Base64URL-decodes the header and payload portions of a JWT and parses the JSON — no key is required and no trust is established. It tells you what the token claims, but not whether those claims are authentic. Verifying checks that the third portion (the signature) was produced by signing the first two parts with the correct secret (for HS256) or private key (for RS256/ES256), confirming the token was issued by a legitimate party and has not been modified in transit. Only verified tokens should be trusted in production — a decoded but unverified token could have been forged by anyone. In Node.js, jwt.verify(token, secret) from the jsonwebtoken library performs both decoding and verification in one step. In Python, jwt.decode(token, key, algorithms=['HS256']) from PyJWT does the same. This tool decodes only — verification must happen on your server with your secret or public key.
What does the exp claim mean?
The exp (expiration time) claim is a Unix timestamp — seconds since 1970-01-01T00:00:00Z — after which the token must not be accepted by any recipient. A token is considered expired when the current Unix time is greater than the exp value. This tool detects expired tokens automatically and shows an orange warning in the status bar with the exact expiry date. Common exp durations relative to the iat (issued-at) value: 300 = 5 minutes (short-lived access tokens), 3600 = 1 hour, 86400 = 1 day, 604800 = 7 days. To convert an exp timestamp to a human-readable date in JavaScript: new Date(payload.exp * 1000).toISOString() — note the multiplication by 1000 because JavaScript's Date constructor expects milliseconds, not seconds. JWT verifiers should allow a small clock skew (typically 60 seconds) to account for drift between servers.
What are the standard JWT claims?
RFC 7519 defines seven registered claim names that have standardised meanings: iss (issuer — the service that created the token, e.g. https://auth.example.com), sub (subject — typically the user ID the token represents), aud (audience — the service(s) the token is intended for), exp (expiration time — Unix timestamp after which the token is invalid), nbf (not before — Unix timestamp before which the token must not be accepted), iat (issued at — Unix timestamp of when the token was created), and jti (JWT ID — a unique identifier that can be used to prevent replay attacks by tracking used token IDs in a blocklist). All seven claims are optional, but exp, sub, and iat are present in almost every real-world JWT. Applications are free to add their own custom claims alongside these registered ones — for example roles, email, or org_id.
What is the difference between HS256, RS256, and ES256?
HS256 (HMAC-SHA256) uses a shared secret known to both the issuer and every verifier. It is simple to set up and fast, but requires that the secret be distributed to every service that needs to verify tokens — creating a secret management challenge in large systems. RS256 (RSA-SHA256) uses a public/private key pair: the issuer signs with the private key (kept secret), and any verifier can check the signature using the public key (freely distributed). This allows multiple services to verify tokens without ever holding signing authority. ES256 (ECDSA with P-256 and SHA-256) works the same way as RS256 but uses elliptic curve cryptography, producing shorter signatures (64 bytes vs ~256 bytes for RS256) and faster verification. Both RS256 and ES256 are preferred for distributed systems, microservices, and third-party integrations. Auth0 and AWS Cognito default to RS256 for this reason. The alg claim in the JWT header identifies which algorithm was used.
Why does a JWT have three parts?
The three dot-separated parts are: (1) Header — Base64URL-encoded JSON describing the token type and signing algorithm. (2) Payload — Base64URL-encoded JSON containing the claims. (3) Signature — the result of signing header + '.' + payload with the secret/private key. The signature allows the receiver to verify the token hasn't been tampered with.
Can I store sensitive data in a JWT payload?
No. The JWT payload is only Base64URL-encoded — it is not encrypted, obfuscated, or protected in any way from being read. Any party that obtains the token can decode the payload in milliseconds, as this tool demonstrates. Never store passwords, credit card numbers, social security numbers, or other sensitive personal data in a JWT payload. For example, storing a user's email address in the payload is generally acceptable (it is already on the token's transport layer), but storing their plaintext password or PII would be a serious security mistake. If you need to transmit genuinely confidential claims that only the recipient should read, use JWE (JSON Web Encryption, defined in RFC 7516) instead of a standard signed JWT (JWS). JWE encrypts the payload so it cannot be read without the recipient's private key. Libraries that support JWE include jose (Node.js/browser), python-jose, and nimbus-jose-jwt (Java).
How do I decode a JWT in JavaScript?
To decode a JWT manually in JavaScript (browser or Node.js): split the token on '.', take the first two parts (header and payload), replace all - with + and _ with / to convert from Base64URL to standard Base64, add = padding until the string length is a multiple of 4, then call JSON.parse(atob(part)). In Node.js (v16+), Buffer.from(part, 'base64url').toString('utf8') handles the conversion in one step. For the idiomatic approach, use the jsonwebtoken library: jwt.decode(token, { complete: true }) returns an object with header, payload, and signature properties without verifying the signature. If you also need to verify, use jwt.verify(token, secretOrPublicKey) which throws if the signature is invalid or the token has expired. The jose library (by Panva) is a modern Web Crypto–based alternative that works in browsers, Node.js, Deno, and Cloudflare Workers.
How do I decode a JWT in Python?
To decode a JWT manually in Python using only the standard library: split the token on '.', take the first two parts, re-add Base64 padding (part += '=' * (4 - len(part) % 4) — but this over-pads if the length is already a multiple of 4, so a safer formula is part += '=' * (-len(part) % 4)), then call json.loads(base64.urlsafe_b64decode(part)). The urlsafe_b64decode function handles the - and _ substitution automatically. For production use, install the PyJWT library (pip install PyJWT): to decode without signature verification use jwt.decode(token, options={"verify_signature": False}); to also verify use jwt.decode(token, key, algorithms=["HS256"]). For RS256 tokens from an identity provider, fetch the JWKS endpoint and use python-jose or jwcrypto which handle key fetching and RSA verification automatically.
Is my token sent to a server?
No. All JWT decoding runs entirely in your browser using JavaScript's built-in atob() and TextDecoder APIs — the token is never transmitted to any server, stored in a database, or logged anywhere. This is a deliberate design choice: JWT tokens often carry authentication credentials, user identity information, and session state that should not be shared with third-party services. You can confirm this by opening the Network tab in your browser's DevTools — zero outbound requests are made when you decode a token. No account, login, or sign-up is required, and the tool works fully offline once the page has loaded. Tab state (the input and output) is saved only to your browser's localStorage and never leaves your device. If you need to decode tokens in a fully air-gapped environment, the page source is available to self-host.

Related Tools

Other free developer tools available on DevFormatter.