Logo

MonoCalc

/

JWT Encoder

Programming

Algorithm

Secret Encoding

HEADER

PAYLOAD

Quick add claims:

Expiry presets (sets iat + exp):

SECRET

⚠ Secret is shorter than 32 bytes. Use a longer secret for better security.

Your JWT will appear here

Fill in the header, payload, and secret on the left. The token is generated automatically as you type.

About HS256

HMAC-256 symmetric signing. The same shared secret is used to both sign and verify the token.

About This Tool

🔐 JWT Encoder / Generator – Create Signed JSON Web Tokens Online

The JWT Encoder is a browser-based tool for creating, signing, and inspecting JSON Web Tokens (JWTs) as defined in RFC 7519. Whether you are building REST APIs, debugging OAuth 2.0 / OpenID Connect flows, or simply learning how JWTs work, this tool lets you compose a token from its three parts — Header, Payload, and Signature — and generates the final encoded string entirely in your browser.

What is a JWT?

A JWT is a compact, URL-safe string made of three Base64URL-encoded segments separated by dots (.):

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9   ← Header
.eyJzdWIiOiJ1c2VyXzEyMyIsImlhdCI6MTcwMDAwMDAwMH0  ← Payload
.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c       ← Signature

The Header declares the token type and signing algorithm. The Payload carries the claims — assertions about the subject plus any custom data you need. The Signature cryptographically binds the first two parts to a secret or key pair, preventing tampering.

Supported Signing Algorithms

AlgorithmTypeUse Case
HS256 / HS384 / HS512HMAC (symmetric)Single-service tokens, microservices with shared secret
RS256 / RS384 / RS512RSA PKCS#1 (asymmetric)Multi-service auth — verifiers only need the public key
ES256 / ES384 / ES512ECDSA (asymmetric)Compact signatures for constrained environments (IoT, mobile)
noneUnsignedTesting only — never use in production

Standard JWT Claims

RFC 7519 defines a set of registered claim names with well-known semantics. Using these consistently enables interoperability across libraries and platforms:

ClaimFull NameDescription
issIssuerIdentifies who issued the token
subSubjectIdentifies the principal (e.g., user ID)
audAudienceRecipients the token is intended for
expExpiration TimeUnix timestamp after which the token is invalid
nbfNot BeforeToken must not be accepted before this time
iatIssued AtUnix timestamp when the token was issued
jtiJWT IDUnique identifier to prevent replay attacks

How to Use the JWT Encoder

  1. Choose an algorithm from the dropdown — start with HS256 for simplicity.
  2. Edit the Header JSON if needed. The tool automatically updates the alg field when you switch algorithms.
  3. Build the Payload — type raw JSON or click the quick-add buttons to insert standard claims like iat, exp, or sub. Use expiry presets (5 min, 1 hr, 24 hr, etc.) to auto-fill timestamps.
  4. Enter your secret (for HMAC) or paste your PEM private key (for RSA/ECDSA). The secret strength indicator warns if your HMAC secret is too short.
  5. Copy the token — the colour-coded output updates in real time. Red = Header, Purple = Payload, Teal = Signature.

Security Considerations

Use test keys only
Always use throwaway secrets and keys when experimenting with browser-based tools. Never paste production secrets or private keys into web applications.

Key security points to keep in mind:

  • HS256 secret length: The NIST recommendation is at least 256 bits (32 bytes) for HS256. Shorter secrets are susceptible to brute-force attacks.
  • Algorithm confusion attacks: Always verify the alg header server-side. Never blindly trust the algorithm specified in a received token.
  • alg: none: Several JWT libraries historically accepted unsigned tokens if the algorithm was set to none. Always explicitly reject none in production code.
  • Sensitive data in payload: The payload is only Base64URL-encoded, not encrypted. Anyone with the token can read the claims. Use JWE (JSON Web Encryption) if the payload contains sensitive data.

RSA / ECDSA Key Format

For RSA and ECDSA algorithms, provide your private key in PKCS#8 PEM format. You can generate a test key pair with OpenSSL:

# RSA 2048-bit key pair
openssl genrsa -out private.pem 2048
openssl pkcs8 -topk8 -nocrypt -in private.pem -out private_pkcs8.pem
openssl rsa -in private.pem -pubout -out public.pem

# ECDSA P-256 key pair (for ES256)
openssl ecparam -name prime256v1 -genkey -noout -out ec_private.pem
openssl pkcs8 -topk8 -nocrypt -in ec_private.pem -out ec_private_pkcs8.pem
openssl ec -in ec_private.pem -pubout -out ec_public.pem

All Processing Happens in Your Browser

The JWT Encoder uses the browser's built-in Web Crypto API for all cryptographic operations. Your header, payload, secret, and private key are never transmitted to any server. The tool works entirely offline once the page has loaded.

Frequently Asked Questions

Is the JWT Encoder free?

Yes, JWT Encoder is totally free :)

Can I use the JWT Encoder offline?

Yes, you can install the webapp as PWA.

Is it safe to use JWT Encoder?

Yes, any data related to JWT Encoder only stored in your browser (if storage required). You can simply clear browser cache to clear all the stored data. We do not store any data on server.

What is a JWT and how is it encoded?

A JSON Web Token (JWT) is a compact, URL-safe token format defined in RFC 7519. It consists of three Base64URL-encoded parts — Header, Payload, and Signature — joined by dots. The Header specifies the algorithm, the Payload carries claims (data), and the Signature ensures integrity.

How does the JWT Encoder tool work?

You provide a Header JSON, Payload JSON, and a signing secret or private key. The tool Base64URL-encodes both the Header and Payload, then signs the concatenation using the selected algorithm (HMAC, RSA, or ECDSA) via the browser's Web Crypto API. The result is a fully valid, signed JWT string.

Which signing algorithms are supported?

The tool supports HMAC family (HS256, HS384, HS512) using a shared secret, RSA family (RS256, RS384, RS512) using a PKCS#8 PEM private key, ECDSA family (ES256, ES384, ES512) using an EC PEM private key, and the 'none' algorithm for unsigned tokens.

Is it safe to use this tool with real secrets or private keys?

All signing happens entirely in your browser using the Web Crypto API — no data is ever sent to a server. However, avoid entering production secrets or private keys into any browser-based tool as a best practice. Use test keys for learning and debugging.

What is the 'none' algorithm and why is there a warning?

The 'none' algorithm produces a JWT with an empty signature, meaning anyone can create tokens without a secret. Some misconfigured servers accept these tokens, which is a serious security vulnerability. The tool shows a prominent warning when 'none' is selected to highlight this risk.

What are standard JWT claims like exp, iat, sub?

Standard registered claims include: 'iss' (issuer), 'sub' (subject), 'aud' (audience), 'exp' (expiration time as Unix timestamp), 'nbf' (not before), 'iat' (issued at), and 'jti' (JWT ID). The tool provides quick-add buttons for each of these claims to speed up token creation.