Skip to content
OddsockLocal
Local
Source text

Formatting

2 wordsRuns in this browser. Nothing is uploaded.

How to use

  1. Set the key size in bytes. 32 is 256 bits.
  2. Choose Base64, Base64URL, or hex to match the consumer.
  3. Copy the value into a secret store, not into a screenshot.

What is Random bytes?

An API example needs a token that is safe to put in a header, and a password full of symbols will get escaped to death. Random bytes draws a key of the size you set, opening at 32 bytes, and prints it as Base64, Base64URL, or hex. Thirty-two bytes is 256 bits. One test draw in standard Base64 is y69YcR0B5AyAzmj2bqW8gt3hsPjsyvCvnYsHXpRSJNU= with the padding equals signs included.

Read more

Base64URL swaps the plus and slash for characters that survive in a URL and can drop the padding, which is what you want in a query string. Hex is longer and easier to compare by eye. The same control exists on the secret-key page, which opens on hex. Use this page when the consumer asked for Base64. Use hex when a config file already stores hex.

The page does not store the token. A 32-byte secret in a chat log is a leaked key, whatever the encoding.

Use cases

  • A developer pastes a 32-byte Base64 token into a local .env that is not committed.
  • A URL parameter needs Base64URL so the slashes do not break the path.
  • A test fixture wants 16 bytes of randomness as hex.
  • An HMAC example needs a key longer than a password.
  • Someone compares the length of 32 bytes in hex versus Base64 before choosing a column type.

A 32-byte token as Base64

Key size 32 bytes, encoding Base64, one value.

y69YcR0B5AyAzmj2bqW8gt3hsPjsyvCvnYsHXpRSJNU= in one test draw. That is 256 bits. Generate your own. The padding character is part of standard Base64.

Why use Oddsock

Oddsock runs this in your browser. It is free, it does not upload the work, and it does not ask for an account.

Related tools

Using this tool

No. It is a way to write bytes as text. Anyone can decode it. The security is that the bytes were random, and that you do not publish them.