A salt is a unique, random value mixed into a password before it is hashed. Salting is what stops two users who happen to choose the same password from sharing the same stored hash, and it makes precomputed attacks such as rainbow tables useless because the attacker would need a separate table per salt. Modern password hashing functions — bcrypt, scrypt, Argon2, PBKDF2 — all require a salt, and it must be generated from a cryptographically secure source. This tool produces salts using the Web Crypto API entirely in your browser.
How it works
The generator allocates a byte buffer and fills it with random data from crypto.getRandomValues, the browser’s cryptographically secure pseudo-random number generator:
- Allocate a
Uint8Arrayof your chosen size (16 bytes by default). - Fill it with
crypto.getRandomValues(bytes)— neverMath.random. - Encode the raw bytes as hex or base64 for storage.
You then store this salt alongside the resulting password hash. Salts are not secret: their security comes from being unique and unpredictable, so it is completely safe to keep them in plain text next to the hash.
Best practices
- Generate a fresh salt for every password — never reuse a single salt across users.
- 16 bytes (128 bits) is the standard minimum; larger salts are fine but rarely necessary.
- The salt is not a replacement for a slow hashing function. Always pair salting with a deliberately slow algorithm like Argon2 or bcrypt with a sufficient work factor.
- Store the salt with the hash; you need it again to verify a login attempt.
Everything here runs locally, so generated salts never touch a network and stay private to your machine.