KeyForge

Hex token generator

Generate cryptographically-random hex strings from the Web Crypto API. Choose the byte length, optionally uppercase. Perfect for session secrets, CSRF tokens, and signing keys.

About hex tokens

secure, random, hexadecimal

What is a hex token?

A hex token is a string of hexadecimal characters (0-9, a-f) representing random bytes. Each byte becomes two hex characters, so a 32-byte token is 64 characters long. Hex tokens are a common, human-readable format for session identifiers, API secrets, and cryptographic keys.

Common uses

Session secrets for web frameworks (Django, Rails, Express), CSRF tokens, webhook signing secrets, oauth client secrets, and encryption key material. A 32-byte (256-bit) hex token is the recommended default for most security purposes.

Lowercase vs uppercase

Toggle the Uppercase (hex) option to switch between lower-case (a-f) and upper-case (A-F) hex output. Lowercase is more common in URLs; uppercase is often used in display contexts or legacy systems. The byte values are identical — only the display changes.

FAQ

about hex token generation
What is a hex token used for?

Hex tokens are used for session secrets, CSRF tokens, webhook signing keys, OAuth client secrets, encryption key material, and anywhere a simple, human-readable random string is needed.

How long should my hex token be?

32 bytes (64 hex characters / 256 bits) is the recommended default for most security purposes. 16 bytes (128 bits) is adequate for CSRF tokens. For encryption keys, follow your algorithm's requirements.

What is the difference between lowercase and uppercase hex?

Nothing in terms of randomness — only the display format. Lowercase (a-f) is conventional in URLs and modern systems; uppercase (A-F) is sometimes required by legacy protocols. Both represent the same byte values.

Can I generate uppercase hex tokens?

Yes. Check the 'Uppercase (hex)' option and all generated hex characters will be upper-case (A-F).

More KeyForge generators

pick a variant

UUID V4

Generate random UUID v4 identifiers straight from crypto.randomUUID. RFC 4122 compliant, one or many

Free Open

Base64URL Token

Generate cryptographically-random Base64URL tokens from the Web Crypto API. URL-safe, no padding, gr

Free Open

API Key Generator

Generate random alphanumeric API keys and secrets. Set a custom prefix to match your service's forma

Free Open

Random Secret

Generate a 64-byte (512-bit) cryptographic secret as hex. Use it for Django SECRET_KEY, Rails secret

Free Open

Questions or feedback?

a reply within 2 business days

Spotted a bug, want a feature, or just have feedback on KeyForge? Send us a note and we will get back to you.

Prefer to talk it through? Book a 30-min call →