Salt and nonce generator
Generate random salts and nonces of the sizes cryptography libraries expect: 128-bit salts, 96-bit nonces for AES-GCM and 192-bit nonces for XChaCha20.
runs in your browser · nothing uploaded
How to use it
- Choose a salt or nonce size from the list.
- Choose hex or Base64 and how many you need.
- Copy them into your test data or fixtures.
Salt or nonce?
A salt is random data mixed into a password hash so that two users with the same password get different hashes, and precomputed tables are useless. It is stored next to the hash and does not need to be secret. 16 bytes (128 bits) is the usual size.
A nonce (number used once) or IV goes with each encrypted message. It must never repeat under the same key: reusing an AES-GCM nonce lets an attacker recover the plaintext difference and forge messages. AES-GCM uses 96 bits; XChaCha20-Poly1305 uses 192, which is large enough to pick at random safely.
Let your library do it
Password libraries (bcrypt, Argon2, scrypt wrappers) make and store the salt for you, and encryption code should create a fresh nonce for every message. Use this page for test vectors, fixtures and learning, not to paste a fixed nonce into production code.
Questions
Is the value sent to a server?
No. It is made in your browser with JavaScript and the Web Crypto API. Nothing is uploaded, logged or stored by us. For production secrets you may still prefer to generate them on the machine that uses them; the command for that is on this page.
Does a salt need to be secret?
No. It is stored openly next to the hash. Its job is to be unique, not hidden.
Can I generate one in a terminal?
Yes: openssl rand -hex 16 prints a 128-bit salt in hex. Our run is in examples/generators.