JWT Decoding·6 min read·Updated October 22, 2026

How to Decode a JWT: Step-by-Step Base64URL and Payload Inspection

A JSON Web Token in compact serialization consists of three strings separated by dots: Header, Payload, and Signature. Because Header and Payload are simply Base64URL-encoded strings, anyone who can intercept a token can immediately decode and read its contents.

Critical Distinction: Decoding is NOT Verification

Decoding merely transforms Base64URL bytes back into readable JSON. It proves NOTHING about whether the token was issued by a trusted server, whether it has been tampered with, or whether the signature is valid. Never trust claims in a decoded token without executing full cryptographic verification against your secret key.
warning Note

Decoding a JWT only reveals its contents. Anyone can forge a payload and re-encode it. Only cryptographic signature verification proves authenticity.

Decoding a JWT in Pure JavaScript

You can decode a JWT in any browser or Node.js environment without external dependencies:
javascriptPure JavaScript client-side JWT decoder function
function decodeJwtPayload(token) {
  const parts = token.split('.');
  if (parts.length !== 3) throw new Error('Invalid JWT format');
  
  // Base64URL to standard Base64:
  const base64 = parts[1].replace(/-/g, '+').replace(/_/g, '/');
  // Decode UTF-8:
  const json = decodeURIComponent(
    atob(base64)
      .split('')
      .map(c => '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2))
      .join('')
  );
  return JSON.parse(json);
}
Generate in Browser

Need a cryptographically secure JWT secret right now?

Generate 128 to 512-bit keys in Hex or Base64 using Web Crypto with zero server transmission.

Launch Generator

Frequently Asked Questions

Are JWT tokens encrypted by default?

No! Standard JWS (JSON Web Signature) tokens are signed, not encrypted. Their contents are public. If you need confidential payloads, you must use JWE (JSON Web Encryption).

How to Decode a JWT – Step-by-Step Guide with Code Examples | JWT Secret Key Generator | JWT Secret Key Generator