Encode JWT

Encode a JSON header and payload into compact JOSE token form.

freeworks offlinenothing uploaded
ToolJWT Encoder
Input
Output
Put this on your own site

The frame below runs the same code as this page, in the reader's own browser. Nothing is sent to us, and nothing is sent to you.

Pick a dark background and the text and panels follow it, so the frame stays readable on a dark page.

Preview

How it works

A JSON header and payload are UTF-8 serialized, Base64url-encoded, joined with periods, and optionally signed using the selected JOSE algorithm. The encoded bytes are the signing input, so serialization choices affect the resulting token.

  • Compact serialization keeps tokens portable in HTTP headers.

Worked example

Sign user claims with HS256
Create an HMAC-signed JWT from a JSON claims payload (uses default secret and HS256)
Input
											{"sub":"1234567890","name":"John Doe","role":"admin","iat":1516239022}
										
Output
												eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwicm9sZSI6ImFkbWluIiwiaWF0IjoxNTE2MjM5MDIyfQ.9AILqmNntS1nzSGb8Y_2HqmgQRoUhw5syBVsIoACMYE
											

When to use this

API clients, JOSE fixtures, and signed integration requests encode tokens.

Edge cases

  • Changing property order or whitespace can change the signature input.
  • An unsigned token is readable but must not be trusted as authenticated.
  • Base64url is not ordinary Base64 with interchangeable padding rules.

References