TToolbox
🎫

JWT Decoder

Decode JWT header and payload

About this tool

JSON Web Token (JWT, RFC 7519) is a compact, URL-safe standard for securely transmitting information between parties as a JSON object. Widely adopted for stateless authentication and Single Sign-On (SSO), a standard JWT comprises three parts separated by dots: Header, Payload, and Signature. This tool decodes JWTs entirely in your browser to inspect claims, scopes, and expiration without sending your token over the wire.

How to Use This Tool (Step-by-Step)

1

Paste Your Encoded JWT

Paste your raw Bearer token into the input area. The tool automatically removes any accidental 'Bearer ' prefixes and surrounding whitespace.

2

Inspect Header & Payload Claims

The tool immediately decodes the Base64Url segments, displaying clean JSON for the header (alg, typ) and payload claims (sub, iss, exp).

3

Verify Expiry & Copy Claims

Automatically calculates expiration time against the current clock, highlighting validity status so you can copy clean JSON fields instantly.

100% Client-Side Privacy

Decoding occurs entirely in your browser using client-side JavaScript. Tokens never traverse any network, safeguarding active production session keys.

Instant Expiration Alert

Instantly converts Unix timestamps (exp, nbf) into human-readable local times, displaying whether the token is currently active or expired.

RFC 7519 Base64Url Support

Fully handles Base64Url character mapping ('-' to '+', '_' to '/') and automatically appends missing '=' padding to prevent parsing errors.

Security Principles & Common Pitfalls

  • •Base64Url decoding is NOT validation: Anyone can tamper with a token's claims. Never trust claims on the backend without cryptographic signature verification.
  • •Never store confidential secrets in Payload: Payloads are merely encoded, not encrypted. Anyone who intercepts the token can read plain fields. Keep passwords out.
  • •exp is in seconds, not milliseconds: RFC 7519 mandates seconds for exp. When checking expiry in JavaScript against Date.now(), multiply exp by 1000.

Code & Transformation Examples

JWT Three-Part Structure Breakdown

Raw Encoded JWT
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTYiLCJuYW1lIjoiQWxpY2UiLCJyb2xlIjoiYWRtaW4iLCJleHAiOjE3NzQwMDAwMDB9.d7s8f9...
Decoded Payload JSON
{
  "sub": "123456",
  "name": "Alice",
  "role": "admin",
  "exp": 1774000000
}

* Header declares HMAC-SHA256 algorithm; payload provides user identity and role claims.

Native Frontend Decoding Snippet

JavaScript (Vanilla)
function parseJwt(token) {
  const base64Url = token.split('.')[1];
  const base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/');
  return JSON.parse(decodeURIComponent(escape(atob(base64))));
}
Usage
const payload = parseJwt(token);
console.log("User ID:", payload.sub);
console.log("Is Expired:", Date.now() >= payload.exp * 1000);

* Client-side decoding is for reading claims only and must never substitute for backend signature validation.

Frequently Asked Questions

Q: Why doesn't decoding a JWT require a secret key?

A: Because the Header and Payload are only Base64Url-encoded for text transport, not encrypted. A secret key is only needed to verify the Signature against tampering.

Q: What do the standard JWT registered claims mean?

A: Key claims include: sub (Subject / User ID), iss (Issuer), aud (Audience), exp (Expiration time), nbf (Not Before), iat (Issued At), and jti (JWT ID).

Q: Why does my token show as invalid or fail to parse?

A: Ensure the token contains exactly two dot ('.') separators. Truncated tokens, trailing line returns, or illegal non-Base64Url characters will cause parsing to fail.

Related Tools

All processing happens locally in your browser. Your data is never uploaded to a server.
/