🔑 JWT Decoder

Decode and analyze JSON Web Tokens (JWT) with detailed inspection

Paste your JWT token in the format: xxxxx.yyyyy.zzzzz
💡 About JWT

JSON Web Token (JWT) is a compact URL-safe means of representing claims to be transferred between two parties.

  • Header: Contains token type and signing algorithm
  • Payload: Contains the claims (data)
  • Signature: Verifies the token hasn't been altered
  • Common Claims: exp (expiration), iat (issued at), sub (subject)

About JWT Decoder Tool

A JSON Web Token (JWT) Decoder is an online utility that parses and decodes JSON Web Tokens into their human-readable components. JSON Web Tokens are a compact, URL-safe means of representing claims to be transferred between two parties. They are widely used in modern web applications for user authentication, stateless sessions, API authorization, and secure single sign-on (SSO) flows. Because a JWT is serialized as a single, base64url-encoded string, it is difficult to read directly without decoding. This debugger solves that by instantly parsing the token on your device.

A standard JWT is composed of three parts, separated by periods (.): the Header, the Payload, and the Signature. The Header typically states the token type (JWT) and the signing algorithm (such as HS256 or RS256). The Payload contains the "claims," which are statements about an entity (typically the user) and additional metadata like expiration times. The Signature is used to verify that the sender of the JWT is who it claims to be and to ensure that the message was not altered along the way. Our tool decodes these sections and presents them in a formatted, syntax-highlighted JSON viewer.

Security is critical when dealing with authentication tokens. Our JWT Decoder executes its decoding routines entirely on the client side using JavaScript inside your browser. No data is sent to external servers or logged in database systems, ensuring that your secret session credentials and user details remain confidential. This allows developers to debug API tokens, inspect user roles, and check token lifespan settings safely.

Key Features

Color-Coded Token Breakdown

The interface splits tokens into Header (red), Payload (blue), and Signature (green) sections. This match-mapping helps you identify components in the encoded string instantly.

Automated Date & Epoch Conversion

Convert Unix epoch timestamps (like exp, iat, and nbf claims) into local timezone dates, allowing you to verify when a token was issued and when it expires.

Client-Side Local Decoding

Perform decoding operations locally in the browser. Protect sensitive user information and authentication tokens by ensuring no network requests are sent during the process.

Signature Validation Tester

Input your symmetric secret or asymmetric public key to test signature verification. The tool validates if the signature matches the header and payload data.

How to Use JWT Decoder Tool

1

Paste Encoded JSON Web Token

Copy your encoded JWT string (the long text containing two dots) and paste it into the input area.

2

Review Decoded Claims

Examine the parsed JSON output. The Header shows the signing algorithm, and the Payload shows the user claims.

3

Inspect Expiration and Dates

Check the parsed dates tab. Confirm that the token expiration date is set correctly and has not expired.

4

Verify Token Signature (Optional)

If you want to verify the signature, enter your secret key in the signature area to check if the signature is valid.

When debugging JWTs, the most common task is checking user permissions and token expiration. When you paste your token into our debugger, look at the Payload section. Here, you will find keys like sub (subject, usually the user ID), roles or scopes (which define user access levels), and exp (expiration timestamp). If your API returns a 401 Unauthorized error, check if the exp date has passed. The tool will highlight expired tokens in red.

It is important to remember that JWTs are signed but not encrypted by default. Base64Url encoding is not encryption; it is simply a format translation. Anyone who intercepts a JWT can decode the payload and read the user details inside. For this reason, you should never store sensitive data, such as passwords or credit card numbers, inside a JWT payload.

Benefits of Using Our Tool

Speed Up API Integration

Quickly troubleshoot authorization errors. Verify that authorization headers are structured correctly and contain required scopes before sending requests.

Verify Token Lifespans

Audit your session expiration settings. Ensure that tokens are configured to expire after short periods to minimize security risks if a token is intercepted.

Secure Authentication Testing

Verify that tokens generated by your authentication server (such as Auth0, Firebase, or custom OAuth services) match configuration designs.

JSON Web Tokens serve as the backbone of modern stateless authentication architectures. To implement JWT authorization securely, developers must understand the serialization format, signature algorithms, and security guidelines.

Understanding Base64Url Encoding

A JWT is serialized using Base64Url, which is a variation of standard Base64 encoding designed for use in URLs. Standard Base64 uses characters like + and /, which have special meanings in URL paths and queries, and uses = for padding. Base64Url addresses this by replacing + with - (minus), replacing / with _ (underscore), and omitting the trailing padding characters. Below is the difference in character sets:

  • Standard Base64: A-Z, a-z, 0-9, +, / (padding: =)
  • Base64Url: A-Z, a-z, 0-9, -, _ (no padding)

Verifying HS256 Signatures in Node.js

The backend verifies the token integrity by rehashing the encoded header and payload with the secret key and verifying it matches the token signature. Here is how that verification looks in Node.js:

const crypto = require('crypto');

function verifyJWT(token, secret) {
    const [headerB64, payloadB64, signatureB64] = token.split('.');
    if (!headerB64 || !payloadB64 || !signatureB64) return false;

    // Create signature hash
    const input = `${headerB64}.${payloadB64}`;
    const hash = crypto.createHmac('sha256', secret)
                       .update(input)
                       .digest('base64')
                       .replace(/\+/g, '-')
                       .replace(/\//g, '_')
                       .replace(/=/g, '');

    return hash === signatureB64;
}

JWT Security Best Practices

When implementing token-based authorization in your applications, keep these security guidelines in mind:

  1. Use short expiration windows: Limit token lifetimes (e.g., 15 minutes) and implement refresh tokens to minimize risks if a token is intercepted.
  2. Store tokens securely: Store JWTs in HttpOnly, Secure, and SameSite=Strict cookies rather than in browser localStorage. This protects tokens from cross-site scripting (XSS) attacks.
  3. Validate algorithms explicitly: When verifying tokens, force the application to use the expected algorithm (e.g., RS256) rather than reading it from the token header, preventing "alg: none" bypass vulnerabilities.

By understanding token mechanics and securing their transmission, developers can build fast, scalable authentication systems that protect user identities.

Frequently Asked Questions (FAQs)

What is a JSON Web Token (JWT) and how does it work?

expand_more
A JSON Web Token (JWT) is an open standard (RFC 7519) that defines a compact and self-contained way for securely transmitting information between parties as a JSON object. When a user logs in, the authentication server generates a JWT containing user details (claims) and signs it using a secret key or public/private key pair. The client stores this token (usually in local storage or cookies) and sends it in the Authorization header on subsequent API requests. The API server verifies the signature to authenticate the request without querying a database.

Can I read the contents of a JWT without the secret key?

expand_more
Yes, anyone can decode and read the contents of a JWT without a secret key. The Header and Payload are encoded using Base64Url, which is a reversible encoding scheme. The secret key is only required to verify the Signature, which guarantees that the header and payload have not been modified. If a client alters the payload (e.g., changing their role to "admin"), the signature becomes invalid, and the API server will reject the token.

What do claims like exp, iat, and sub mean inside a JWT?

expand_more
These are standard, registered claims defined in the JWT specification. "sub" (Subject) identifies the principal of the JWT (such as a unique user ID). "iat" (Issued At) is the Unix epoch timestamp indicating when the token was created. "exp" (Expiration Time) is the timestamp indicating when the token must cease to be accepted. "nbf" (Not Before) defines the exact time before which the token cannot be used, and "iss" (Issuer) identifies the server that generated the token.

What is the difference between HS256 and RS256 signing algorithms?

expand_more
HS256 (HMAC with SHA-256) is a symmetric algorithm, meaning that a single secret key is shared between the authentication server (which generates the token) and the API server (which validates it). RS256 (RSA Signature with SHA-256) is an asymmetric algorithm that uses a public/private key pair. The authentication server signs the token using a private key, and the API server validates the signature using the matching public key, which is safer as the private key is never shared.

Is it secure to paste my JWT into this online decoder?

expand_more
Yes, using our tool is secure because all decoding processes run locally in your web browser. The tool utilizes JavaScript to parse the token string and render it on your screen. Your token data is never sent over the internet or logged in database servers. However, as a best practice, you should avoid pasting production tokens containing sensitive access permissions into any online utility.
Chat on WhatsApp