Skip to content

Menu

Random Bytes Generator

Generate cryptographically secure random bytes

Runs entirely in your browserGeneratorsFree, no sign-up
Loading tool

01What is Random Bytes Generator?

Sometimes you just need 32 truly random bytes. Maybe it is a signing secret for a local JWT setup, a salt for a test vector or a placeholder API token. This tool gives you those bytes in the format you need, without opening a terminal. The bytes come from crypto.getRandomValues, part of the W3C Web Cryptography API. Browsers back it with the operating system's cryptographically secure random source. That matters, because Math.random is not designed for secrets and its output can be predictable. Each value gets its own fresh Uint8Array, filled in one call. You set three things. Bytes runs from 1 to 1024. Count runs from 1 to 20 and controls how many separate values you get. Format picks how the bytes are written out. Hex prints each byte as two lowercase digits. Base64 encodes the whole buffer using the standard alphabet from RFC 4648, with + and / and = padding. Decimal lists the byte values 0 to 255 separated by commas. Binary shows eight bits per byte with spaces between them. A small label next to the buttons converts bytes to bits, so 32 bytes shows as 256 bits. A worked example makes the formats concrete. Take the four bytes 0, 15, 128 and 255. Hex gives 000f80ff. Base64 gives AA+A/w==. Decimal gives 0, 15, 128, 255. Binary gives 00000000 00001111 10000000 11111111. Those are exactly what the tool's formatting code prints for that input. The real tool will of course hand you random bytes rather than these. Output sizes are easy to predict. A 32-byte value is 64 hex characters or 44 Base64 characters. A 16-byte value is 24 Base64 characters with two padding signs at the end. A few things to know. New values appear only when you press Generate. If you change Format afterwards, the same bytes are redrawn in the new format. Copy puts every value on the clipboard, one per line. Picking one of the 16, 32 or 64 byte presets sets the byte count and clears the list. There is no Base64URL option, so swap characters yourself if you need it. The bytes are made and shown inside your tab only, but anything shown on screen can still leak through screenshots or shared clipboards.

Backend developers who need a quick secret, salt or token for a local or test environment and want it from a secure random source rather than Math.random. The tool runs entirely in your browser, so your data never leaves your device.

02How to use Random Bytes Generator

  1. Set Bytes, or click a 16, 32 or 64 byte example to fill it in.
  2. Choose a Format: Hex, Base64, Decimal or Binary.
  3. Set Count if you want more than one value.
  4. Check the bits label next to the buttons to confirm the key size.
  5. Click Generate, then Copy to take every value, one per line.

03Worked examples

Input: Bytes 0, 15, 128, 255 - Format Hex
Result: 000f80ff
Fixed bytes passed to the tool's own formatting code to show the format. Real output is random.
Input: Bytes 0, 15, 128, 255 - Format Base64
Result: AA+A/w==
Shows the standard alphabet characters + and / and the = padding.
Input: Bytes 0, 15, 128, 255 - Format Decimal
Result: 0, 15, 128, 255
Comma plus space between values.
Input: Bytes 0, 15, 128, 255 - Format Binary
Result: 00000000 00001111 10000000 11111111
Eight bits per byte, space separated.
Input: Bytes 32, Format Hex then Base64
Result: 64 characters (Hex), 44 characters (Base64)
Lengths measured from real random output. The values themselves change every run.

04Common use cases

  • Creating a 32-byte hex secret for HS256 JWT signing in a local or staging .env file
  • Generating a session secret for an Express or Django dev setup
  • Producing a 16-byte salt or nonce for a unit test vector
  • Making a batch of 20 hex tokens to seed a local database of fake API keys
  • Getting a Base64 value to paste into a config field that expects Base64-encoded key material
  • Checking what 64 random bytes look like in binary while teaching how encodings differ

05Tips

  • Changing Format redraws the current bytes, so you can view one value as hex and then Base64 without generating again.
  • Standard Base64 can contain + and /, which break URLs. Replace them with - and _ and drop the = padding for Base64URL.
  • Many libraries treat a hex string as text, not bytes. A 64-character hex secret may be read as 64 bytes of ASCII, so check what your library expects.
  • For real production keys, generate them on the server or in a secrets manager, so they never pass through a clipboard.

06Related concepts

CSPRNG, Web Crypto API, Entropy, Base64, Secret key.

Frequently Asked Questions

What is Random Bytes Generator?

Random Bytes Generator is a free, browser-based developer tool on AIDToolStack. Generate cryptographically secure random bytes It requires no installation or sign-up and works entirely in your browser.

Is Random Bytes Generator free to use?

Yes. No sign-up, no fees and no usage cap.

Does Random Bytes Generator store my data?

No. It runs in your browser; nothing is uploaded.

Reviews and commentsShow

Reviews

Sign in to leave a review.

Loading reviews…

Comments

Sign in to leave a comment.

Loading comments…

What changed in AI dev tools, once a month

Renames, shutdowns, pricing changes and new MCP setups, each with a source.

Subscribe