About this tool
A bearer token is whatever the client presents in Authorization: Bearer <token>: whoever “bears” it gets access, with no further proof. Tokens can be self-contained JWTs or opaque random strings that the server looks up in its database. This generator makes secure opaque tokens for seeding test users, mocking an auth server, or issuing access tokens from your own API.
Opaque tokens or JWTs?
- Opaque tokens (this page) are random and meaningless. The server stores a hash and looks it up on each request, so revoking access is instant.
- JWTs carry signed claims and can be verified without a database lookup, but they’re hard to revoke before they expire. Create them with the JWT Generator.
Handling bearer tokens safely
- Only over HTTPS, because anyone who sees the token can use it.
- Never in URLs, where they end up in logs and browser history; send them in the Authorization header.
- Store hashes (SHA-256) server-side, give tokens an expiry, and support revocation.
- Prefixes help detection: a recognisable prefix like
at_lets secret scanners find leaked tokens.
FAQ
What is a bearer token?
A token sent in the Authorization: Bearer header. Possessing it is enough to access the API, so it must be kept secret and sent only over HTTPS.
How long should a bearer token be?
At least 128 bits of randomness; 256 bits is the common choice.
How do I send a bearer token with curl?
Add -H "Authorization: Bearer YOUR_TOKEN" to the command. The page shows ready-made curl and fetch examples.
Is a bearer token the same as a JWT?
Not necessarily. A JWT can be used as a bearer token, but bearer tokens can also be opaque random strings, like the ones generated here.