💻 Coding

JWT Encoder/Decoder

Decode a JSON Web Token to inspect its header and payload, verify an HS256 signature, or encode your own token, all client-side.

Presets:

What is a JSON Web Token (JWT) and How Does It Work?

Quick Answer: A JSON Web Token (JWT, defined by RFC 7519) is a compact, URL-safe container format for securely transmitting claims between two parties. Composed of three dot-separated Base64URL-encoded parts (Header, Payload, and Cryptographic Signature), JWTs guarantee data integrity so backends can trust user identities and permissions without maintaining server-side session databases.

Modern microservices, single-page web applications, and OAuth 2.0 / OpenID Connect authorization flows rely overwhelmingly on JSON Web Tokens as stateless bearer credentials. Before JWTs gained industry dominance, web applications maintained stateful sessions stored in centralized databases like Redis or Memcached. Every incoming HTTP request necessitated a remote database query to resolve session cookies into user identity records. By encapsulating user identity, scopes, and expiration timestamps inside a cryptographically signed payload, JWTs allow microservices to verify caller credentials locally in nanoseconds without querying a shared database.

This online JWT Encoder and Decoder provides an enterprise-grade debugging environment for backend developers, security engineers, and DevOps architects. Running entirely client-side inside your browser, it decodes and color-codes token parts, calculates human-readable timestamps for epoch claims, verifies HMAC-SHA256 signatures via native browser cryptography, and encodes new tokens with zero server uploads.

Anatomy of a JSON Web Token: The Three-Part Triad

A serialized JWT presents as a single string containing three distinct Base64URL-encoded JSON segments separated by literal periods (.): header.payload.signature.

Base64URL Encoding versus Standard Base64

A frequent beginner misconception is assuming JWT segments are encrypted. In reality, the header and payload are merely Base64URL-encoded. Standard Base64 encoding utilizes sixty-four characters consisting of uppercase letters, lowercase letters, digits, and the characters plus (+) and forward slash (/), with trailing equal signs (=) serving as padding.

However, +, /, and = carry reserved syntactic meanings in URLs, HTTP query strings, cookies, and Authorization headers. If standard Base64 were transmitted across URLs, web servers and proxies would percent-encode or mangle characters. Base64URL (RFC 4648 Section 5) solves this by replacing + with hyphen (-), replacing / with underscore (_), and omitting trailing padding characters entirely. This makes raw JWTs safe for immediate transport across all web protocols without escaping.

RFC 7519 Registered Claims Reference Table

Claim Key Name Description & Purpose Format / Value Type Verification Rule
iss Issuer Identifies the principal that issued the token String / URI (e.g., https://auth.example.com) Must match expected authentication server
sub Subject Identifies the user or resource principal String (e.g., user_1042) Used as primary key for user authorization
aud Audience Identifies target recipients or API resource servers String or Array of strings API rejects token if its identifier is not listed
exp Expiration Time Timestamp after which token must be rejected NumericDate (Unix epoch seconds) Current time must be strictly before exp
nbf Not Before Timestamp before which token must not be accepted NumericDate (Unix epoch seconds) Current time must be at or after nbf
iat Issued At Timestamp when the token was created NumericDate (Unix epoch seconds) Tracks token age and refresh cadence
jti JWT ID Unique identifier for one-time token tracking String (UUID or random string) Enables token blacklisting to prevent replay attacks

Symmetric Signing (HS256) versus Asymmetric Signing (RS256/ES256)

Choosing the correct signing algorithm depends directly on the trust boundary between your authorization server and consuming API services:

Signed Integrity (JWS) versus Encrypted Confidentiality (JWE)

A critical security vulnerability arises when engineers treat JWTs as encrypted containers. Standard JWTs (implemented as JSON Web Signatures, or JWS) guarantee authenticity and integrity, not confidentiality. Anyone who intercepts the token string can paste it into this decoder and view every claim in plaintext.

Under zero-trust architectural guidelines, you should never place sensitive credentials, plaintext API keys, passwords, or personal health records inside standard JWT claims. If your architecture mandates that payload contents remain hidden from clients and intermediaries, you must implement JSON Web Encryption (JWE, RFC 7516), which wraps and encrypts the claims using algorithms like AES-GCM before transport.

Common JWT Vulnerabilities and Hardening Strategies

Security researchers frequently encounter authentication bypasses caused by insecure JWT parser implementations:

Clock Skew, Expiration Leeway, and Refresh Token Architecture

In distributed cloud architectures spanning dozens of servers across geographic regions, internal hardware clocks are never perfectly synchronized despite NTP daemons. A token generated on Server A might arrive at Server B five hundred milliseconds before Server B thinks it was issued.

To prevent premature claim rejections, production JWT evaluators configure a small clock skew tolerance (typically 30 to 60 seconds) when validating exp and nbf claims. In addition, because stateless access tokens cannot be revoked without maintaining a centralized blacklist, best practice dictates keeping access token lifetimes short (e.g., 5 to 15 minutes) paired with long-lived refresh tokens stored securely in HTTP-only cookies.

Zero-Trust Architecture: 100 Percent Client-Side Privacy

Authentication credentials represent the crown jewels of application security. When debugging production issues, engineers often need to decode live Bearer tokens containing employee IDs, email addresses, and tenant identifiers. Pasting live authorization tokens into online decoders that transmit payloads to third-party cloud servers creates acute compliance violations under SOC 2, HIPAA, and GDPR.

Utility369 guarantees total client-side privacy. The entire token parsing, Base64URL decoding, claim formatting, and HMAC-SHA256 signature verification pipeline executes locally inside your web browser using standard Web Crypto API primitives (window.crypto.subtle). Zero tokens, secrets, or claim data are ever transmitted to any remote server.

Frequently Asked Questions

Can I decode a JWT without knowing the signing secret?

Yes. The header and payload of a standard JWT are Base64URL-encoded JSON objects, not encrypted. Anyone who possesses the token string can read the claims without knowing the secret. The cryptographic secret is required only to verify or compute the signature.

Why does a JWT use base64url instead of regular base64?

Standard Base64 contains characters (+, /, and =) that carry reserved syntactic meanings in URLs, HTTP headers, and cookies. Base64URL substitutes + with - and / with _, while dropping trailing padding = characters, enabling safe transport without percent-encoding.

What do the exp, iat, and nbf claims represent in a JWT?

These are standardized RFC 7519 timestamp claims measured in Unix epoch seconds. 'exp' (Expiration Time) marks when the token becomes invalid, 'iat' (Issued At) denotes token generation time, and 'nbf' (Not Before) specifies when token validity begins.

What is the difference between symmetric HS256 and asymmetric RS256 signing?

HS256 (HMAC-SHA256) uses a single shared secret key for both token generation and signature verification. RS256 (RSA Signature with SHA-256) uses an asymmetric private key to sign the token and a corresponding public certificate to verify it.

Should sensitive passwords or private data be placed inside a JWT payload?

No. Because JWT payloads are readable by anyone who inspects the token, sensitive credentials, credit card numbers, or passwords should never be stored in token claims. JWTs provide cryptographic integrity, not payload confidentiality.

Are my secret keys or tokens transmitted to an external server?

No. All decoding, encoding, and HMAC-SHA256 signature verifications execute client-side inside your web browser via the standard Web Crypto API (crypto.subtle). Your tokens and secrets never leave your device.

What is the dangerous none algorithm attack and how is it prevented?

Legacy JWT libraries allowed an alg value of none, permitting attackers to bypass signature verification entirely. Modern libraries and this debugger explicitly reject unsigned tokens when a signature check is requested.

What is the difference between a JWT and a JWE?

A JSON Web Token (JWT) signed as a JWS provides verifiable data integrity and authenticity, but its claims remain unencrypted. A JSON Web Encryption (JWE) encrypts the payload, ensuring confidentiality so third parties cannot inspect claims.

How does token expiration leeway work in production microservices?

Clock skew between distributed servers can cause valid tokens to be rejected prematurely. Enterprise decoders often configure a small clock tolerance (such as 30 to 60 seconds) when evaluating exp and nbf timestamps.

Can this tool generate valid signed JWTs directly in the browser?

Yes. By entering custom header and payload JSON alongside an HS256 secret key, this tool uses the browser Web Crypto API to compute HMAC-SHA256 digests and output fully compliant dot-separated tokens.