Random Hexadecimal Generator
Generate a random hexadecimal (base-16) string of any byte length, useful for tokens, color codes, and testing.
Recommended Settings
Pro Tips
- •Each byte becomes exactly 2 hex characters, so 8 bytes produces a 16-character hex string
- •Hexadecimal is commonly used for color codes, memory addresses, and cryptographic tokens
- •This uses the Web Crypto API for randomness, the same secure source used for the site's password generators
- •For a 6-character color-style hex code, set the length to 3 bytes
Most Popular
Most users generate 16 or 32-byte values for tokens, session IDs, or cryptographic keys
When to Use This Tool
Generate a random hex string to use as a unique identifier or placeholder token.
Create random hex values for testing parsers or data pipelines.
Generate example hex values for teaching number systems or memory addressing.
Generate a random 3-byte hex string as a starting point for a color code.
How It Works
Generate the requested number of random bytes using the Web Crypto API
Convert each byte to its two-character hexadecimal representation
Join the results into a single hex string and display it, updating live as you adjust the length
100% Private
Files never leave your device. All processing happens locally in your browser.
Lightning Fast
Powered by Web Crypto API (crypto.getRandomValues) for optimal performance on modern browsers.
Open Source
Built with verified, open-source libraries. Fully transparent.
Frequently Asked Questions
How long can the result be?
Between 1 and 64 bytes (2 to 128 hex characters) using the slider.
Is this suitable for generating security tokens?
It uses the Web Crypto API's cryptographically secure random source, the same one used for this site's password generators, so it's suitable for tokens and similar identifiers.
Is my data sent to a server?
No. The hex string is generated entirely in your browser.
Can I get a valid CSS color code?
Set the length to 3 bytes for a standard 6-character hex color code, though not every combination will look aesthetically pleasing.
What's the difference between this and Random Binary Generator?
Both generate random data, but this displays it in base-16 (hexadecimal) rather than base-2 (binary), which is more compact and commonly used for tokens and color codes.