Tools

Home
Password GeneratorLorem IpsumCoin FlipperRandom NumberToken GeneratorRandom Color

Generate Random Bytes

Generate random byte values (0-255). Output as decimal, hex, binary, or base64. 100% client-side.

Your files never leave your browser
Presets:
Bytes:0
Format:-
Output size:-
Ready·Uses crypto.getRandomValues

Generate cryptographically secure random bytes in hex, decimal, binary, or base64 — just set a count, pick a format, and hit Generate. Useful any time you need an encryption key, IV, salt, or test payload without writing a script. And everything runs in your browser. Nothing gets uploaded.

How It Works

Set Count & Format
→
crypto.getRandomValues()
→
Formatted Output

Your browser fills a Uint8Array with cryptographically random bytes, then formats each value according to your selection. Hex gives you two characters per byte (00–ff), decimal gives you numbers 0–255, binary spells out all eight bits, and base64 packs everything into a compact ASCII string. The whole thing happens in milliseconds — even at 10,000 bytes.

Examples

AES-256 Encryption Key

You’re setting up AES-256 encryption and need exactly 32 random bytes as a key, formatted in hex for your config file.

INPUT
Count: 32 Format: Hex Separator: Space
OUTPUT
a3 f7 1b 9e 44 c2 08 6d e1 5a b3 72 df 90 3c 8f 27 6e a4 cb 55 19 fd 83 0b e6 48 d1 7a 3f 96 bc

Base64 Token for an API

Quick 16-byte token encoded in base64 — drop it straight into a bearer header or session cookie.

INPUT
Count: 16 Format: Base64
OUTPUT
rT3mKv8Bx5QpNhWdAo2Jcg==

Filling a Test Buffer with Binary Data

You’re writing unit tests for a parser and need 8 bytes of binary to feed into it. Binary format makes bit patterns obvious when debugging.

INPUT
Count: 8 Format: Binary Separator: Newline
OUTPUT
11010011 01001110 10110001 00011111 10001010 01100101 11110100 00101100

Who Uses This

👨‍💻 Backend Developers

Generating encryption keys, salts, and nonces without writing boilerplate code.

🔒 Security Engineers

Creating cryptographically secure random values for tokens, IVs, and test vectors.

🧪 QA Engineers

Producing random binary payloads to stress-test file parsers and network protocols.

🎓 Students

Exploring how hex, binary, decimal, and base64 represent the same underlying data.

Common Mistakes

Using Math.random() instead of crypto

Math.random() is not cryptographically secure — it’s predictable with enough samples. For anything security-related, always use crypto.getRandomValues(). This tool does that automatically.

Wrong byte count for the key size you need

AES-128 needs 16 bytes, AES-256 needs 32. A 12-byte IV is standard for GCM mode. If your encryption fails silently or throws a “bad key length” error, double-check the count first.

Confusing hex string length with byte count

Each byte becomes two hex characters. So 32 bytes of hex output is 64 characters long, not 32. If you paste a 32-character hex string as a “256-bit key,” you actually only have 128 bits.

Technical Details

Frequently Asked Questions

Are the generated bytes cryptographically secure?

Yes — they come from crypto.getRandomValues(), which is the browser’s built-in CSPRNG. It’s the same source browsers use for TLS session keys. Plenty strong for encryption keys, tokens, and anything else that needs real randomness.

What’s the difference between hex, decimal, binary, and base64?

They’re all ways of showing the same raw bytes. Hex is two characters per byte (like “a3”), decimal is a number from 0 to 255, binary is eight 0s and 1s, and base64 encodes three bytes into four ASCII characters. Hex is the most common for crypto work. Base64 is best when you need to paste bytes into JSON or a URL.

How many bytes do I need for an AES key?

AES-128 requires exactly 16 bytes. AES-192 needs 24 bytes. AES-256 needs 32. For a GCM initialization vector, the standard is 12 bytes. Get the count wrong and most libraries will just throw an error.

Is my data sent to a server?

No. Everything happens in your browser tab. Open DevTools and check the Network tab if you want proof — there are zero requests when you hit Generate. Your bytes never leave your machine.

Can I generate the same random bytes again?

Not with this tool — and that’s by design. A CSPRNG doesn’t support seeds or reproducible output. If you need repeatable “random” data for testing, you’d want a seeded PRNG instead. For anything security-related, non-reproducibility is exactly what you want.

Share: