Encoding & Security 6 min read Oct 07, 2026 FormatKit Engineering 6 views

Understanding JWT (JSON Web Tokens): Architecture & Debugging

Demystify JWT anatomy: Header, Payload, and Signature. Learn how base64url encoding works, how to inspect claims, and how to debug authentication tokens safely.
Quick Answer • Key Takeaway
A JSON Web Token (JWT) consists of three Base64URL-encoded strings separated by dots: Header (algorithm), Payload (claims & user data), and Signature (tamper-proofing). Because payload claims are merely encoded, not encrypted, never place sensitive passwords or secret keys inside a JWT payload.
Guide Sections

What is a JSON Web Token (JWT)?

Defined in RFC 7519, a JSON Web Token (JWT) is a compact, URL-safe container for transferring claims between two parties. JWTs are widely used in stateless modern authentication architectures (such as OAuth 2.0 and OpenID Connect), allowing backends to verify user identity without hitting an active database session store on every HTTP request.

The Three Parts of a JWT

Every valid JWT contains three distinct parts separated by period (.) delimiters:

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkphbmUgRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c

1. Header (Algorithm & Token Type)

{
  "alg": "HS256",
  "typ": "JWT"
}

2. Payload (Claims & User Context)

{
  "sub": "user_9831",
  "role": "editor",
  "email": "jane@company.com",
  "exp": 1735689600
}

3. Signature (Tamper Prevention)

HMACSHA256(
  base64UrlEncode(header) + "." + base64UrlEncode(payload),
  secret_key
)

Decode and Inspect Any JWT Token

Inspect token headers, expiration countdown, and user claims with our secure offline JWT decoder.

Open JWT Decoder →

Security Rules for Production JWTs

Security Rules (Do)

Store tokens in HttpOnly, Secure, SameSite=Strict cookies to protect against XSS token exfiltration. Always enforce expiration (exp) claims.

Security Warning (Don't)

Never put passwords, credit card numbers, or internal API secret keys inside JWT claims: claims are readable by anyone who inspects the token.

Frequently Asked Questions

What is Base64URL encoding vs standard Base64?
Base64URL replaces + with -, replaces / with _, and removes trailing padding (=). This ensures the token can be safely placed in HTTP headers and URL query strings without URL-encoding issues.
Where should JWTs be stored in the browser?
For web apps vulnerable to XSS, store tokens in HttpOnly, Secure cookies rather than localStorage. For mobile applications, store tokens in secure hardware keychains.
On This Page
100% In-Browser Privacy

FormatKit tools and interactive code examples run completely in your client browser sandbox. We never store, log, or transmit your code, tokens, or confidential API payloads.