Random Token Generator
Random hex, Base32, Base62 and Base64url tokens.
Options
Result
Nothing to build with these settings.
A random token generator for developers
Generate random tokens in hex, Base32, Base62 or URL-safe Base64, from 8 to 256 characters, with the entropy shown for each.
- Four formats. Hex, Base32, Base62 and Base64url cover most places a token ends up.
- Exact entropy. The bits shown are length times the bits of one character, so you can size a token properly.
- Unbiased output. Characters are chosen with rejection sampling from the browser’s secure random source, so none is more likely than another.
- Batches. Make up to 50 tokens, copy them all or download a text file.
Uses of a random token generator
Anywhere a server needs an unguessable value, a random token is the right tool.
- Session and CSRF tokens. Use at least 128 bits for anything that proves identity.
- Password reset and invite links. Make a long URL-safe token to place in a link.
- Webhook signing and verification. Create a random value to share between two systems.
- Test data and fixtures. Fill a database or mock API with realistic unique IDs.
Random token generator questions
How long should a token be?
For a secret that proves identity, aim for at least 128 bits. That is 32 hex characters, 26 Base32 characters or 22 Base62 characters.
Which format should I use?
Hex is simple and safe everywhere. Base62 and Base64url are shorter for the same strength. Base32 avoids look-alike characters and is case-insensitive.
Is this safe for production secrets?
The values come from a cryptographic random source, so they are suitable. For long-lived secrets, generate them on your own server or secret manager where you can, and never paste one into a site you do not trust.
Is a token the same as a password?
Not quite. A token is made for machines and is never typed, so it can be long and unreadable. Use the password generator for secrets people type.