Free · Live · Nothing is uploaded

JWT generator.
Sign, decode, verify.

Build a JSON Web Token with HS256, HS384 or HS512, add time claims in one click, verify signatures and export code.

Algorithm & secret
Use test secrets only. Never paste a production secret into any website.
Header
Payload
Quick claims

How to create a JWT

Three steps, no account.

Pick algorithm and secret

Choose HS256, HS384 or HS512 and enter a signing secret, or generate a random one.

Edit header and payload

Change the JSON and add iat, exp, nbf or jti claims with one click. The token updates live.

Copy, verify, export

Copy the token, verify any JWT in the Decode tab, or export Node.js, Python or PHP code.

Built for real work

Everything you need to build and debug tokens.

Live signingThe token re-signs on every keystroke using the Web Crypto API.
Decode & verifyPaste any HS256, HS384 or HS512 token to check its signature and expiry.
Code exportReady snippets for Node.js, Python and PHP with your claims.
PrivateYour secret and token never leave your browser. No signup.
Updated November 2026

What is a JWT generator?

A JWT generator creates a JSON Web Token (JWT), the compact string that apps and APIs use to carry identity and permission claims. You write a JSON header and payload, choose an algorithm and a secret, and the tool signs them into a token you can copy straight into a request, a test or a config file.

This free online JWT encoder signs tokens with HMAC (HS256, HS384 and HS512) using the Web Crypto API in your browser. It also decodes and verifies tokens, shows readable dates for iat, exp and nbf, and exports code for Node.js, Python and PHP. Your secret and data are never uploaded.

The structure of a JSON Web Token

A JWT is three Base64URL strings joined by dots: header.payload.signature.

  • Header: JSON describing the token, usually {"alg":"HS256","typ":"JWT"}.
  • Payload: JSON with the claims, such as the user ID and the expiry time.
  • Signature: an HMAC of header.payload made with your secret. If anyone edits the header or payload, the signature no longer matches.

Base64URL is Base64 with - and _ instead of + and /, and no = padding, so a token is safe to put in a URL or HTTP header.

Common JWT claims

ClaimNameMeaning
issIssuerWho created and signed the token, for example your auth server URL.
subSubjectWho the token is about, usually a user ID.
audAudienceWho the token is meant for, such as an API name. Receivers should reject tokens meant for someone else.
expExpiration timeUnix timestamp in seconds after which the token must be rejected.
nbfNot beforeUnix timestamp before which the token must not be accepted.
iatIssued atUnix timestamp of when the token was created.
jtiJWT IDA unique ID, useful for revocation lists and replay protection.

You can add any custom claims you like, such as role or scope. Keep them small, because the token is sent with every request.

JWT signing algorithms: HS256, HS384, HS512

AlgorithmTypeHashRecommended secret
HS256HMAC, shared secretSHA-25632+ random bytes
HS384HMAC, shared secretSHA-38448+ random bytes
HS512HMAC, shared secretSHA-51264+ random bytes
RS256RSA, key pairSHA-256Private key signs, public key verifies
ES256ECDSA, key pairSHA-256Private key signs, public key verifies

HMAC algorithms use one secret for both signing and verifying, so they suit a single service or a small set of trusted services. If many services must verify tokens without being able to create them, use a key-pair algorithm such as RS256 or ES256. This tool supports the HS family only.

JWT security basics

Important: a signed JWT is encoded, not encrypted. Anyone who has the token can read the payload. Never store passwords, card numbers or other secrets inside it.
  • Use a long random secret. Short or guessable secrets can be brute-forced offline.
  • Always set exp. Short-lived access tokens limit the damage if one leaks.
  • Fix the allowed algorithm on the server. Do not trust the alg value in the token header, and never accept none.
  • Validate iss and aud. Reject tokens that were issued by or meant for someone else.
  • Send tokens over HTTPS only and store them carefully on the client.
  • Verify on the server. Decoding a token in the browser proves nothing about whether it is valid.

Common JWT mistakes and how to fix them

  • Timestamps in milliseconds. JWT times are Unix seconds. JavaScript's Date.now() returns milliseconds, so divide by 1000.
  • Invalid signature after editing. Changing any character in the header or payload breaks the signature. Re-sign the token.
  • Wrong secret encoding. Some libraries treat the secret as Base64. This tool uses the secret as plain UTF-8 text, so match that in your code.
  • Clock skew. If servers disagree on the time, nbf and exp checks can fail. Allow a few seconds of leeway.
  • Huge payloads. Large tokens bloat every request and may exceed header size limits.

Create a JWT in Node.js, Python and PHP

The Code tab generates a snippet for your current header, payload and secret. Here is the basic idea in each language.

Node.js (jsonwebtoken)

const jwt = require("jsonwebtoken");
const token = jwt.sign({ sub: "1234", role: "admin" }, process.env.JWT_SECRET, {
  algorithm: "HS256",
  expiresIn: "1h"
});

Python (PyJWT)

import jwt, os, datetime

payload = {"sub": "1234", "exp": datetime.datetime.utcnow() + datetime.timedelta(hours=1)}
token = jwt.encode(payload, os.environ["JWT_SECRET"], algorithm="HS256")

PHP (firebase/php-jwt)

use Firebase\JWT\JWT;

$payload = ['sub' => '1234', 'exp' => time() + 3600];
$token = JWT::encode($payload, getenv('JWT_SECRET'), 'HS256');

What are JWTs used for?

  • API authentication: send a bearer token with each request instead of a session cookie.
  • Single sign-on: pass identity between services in OAuth 2.0 and OpenID Connect flows.
  • Short-lived authorization: email verification and password reset links with an expiry.
  • Service-to-service calls: prove which internal service is calling another.
  • Testing and debugging: create tokens with specific claims to test how your API behaves.

Need other utilities? Browse all developer tools, try the regex tester, or use our image compressor.

FAQs

What is a JWT?

A JSON Web Token (JWT) is a compact, URL-safe string that carries JSON claims between two parties. It has three Base64URL parts separated by dots: a header, a payload and a signature.

Which algorithms does this JWT generator support?

HS256, HS384 and HS512, which are HMAC signatures with a shared secret. RSA and ECDSA algorithms such as RS256 and ES256 need a private key and are not supported.

Is my secret or token sent to a server?

No. Signing uses the Web Crypto API in your browser. The secret, header and payload never leave your device.

Is a JWT encrypted?

No. A standard signed JWT is only encoded, so anyone can read the payload. The signature proves the token was not changed, but it does not hide the data. Never put passwords or secrets in a JWT payload.

What do iat, exp and nbf mean?

iat is the time the token was issued, exp is the time it expires, and nbf is the time before which it must not be accepted. All three are Unix timestamps in seconds.

How do I verify a JWT signature?

Recompute the signature from the first two parts using the same secret and algorithm, then compare it with the third part. The Decode tab does this for you.

What is the difference between HS256 and RS256?

HS256 uses one shared secret to both sign and verify. RS256 uses a private key to sign and a public key to verify, so many services can verify tokens without being able to create them.

How long should a JWT secret be?

Use a random secret at least as long as the hash output: 32 bytes for HS256, 48 for HS384 and 64 for HS512. Avoid short or guessable words.

Can I use tokens from this tool in production?

Use it for testing, debugging and learning. Production tokens should be created on your server with a strong secret kept out of the browser.

Is this JWT generator free?

Yes. It is completely free, needs no signup and works on phones, tablets and computers.

More tools

Related developer, image and PDF tools.

See developer tools →

Need a tool we don't have yet?

Tell us what you need and we will add it to the list.

Contact us