Password Salt Generator

Generate cryptographically secure random salts for password hashing. Choose length, output format, and quantity — pure client-side using window.crypto.getRandomValues.

Salt Options

Entropy: 256 bits

Generated Salts

Click "Generate New Salt" to start

How to use this salt

Copy the hex value and pass it to your hashing function. Example with bcrypt (Node.js):

const salt = await bcrypt.genSalt(12);
// Or with a manual salt prefix (legacy):
const hash = await bcrypt.hash(password, salt);

Note: bcrypt generates its own salt internally. Use these salts for PBKDF2, Argon2, or custom HMAC constructions.

Copied!

Summary

Generate cryptographically secure random salts for password hashing. Choose length, output format, and quantity — pure client-side using window.crypto.getRandomValues.

How it works

  1. window.crypto.getRandomValues fills a Uint8Array with cryptographically random bytes from the operating system's entropy pool. The bytes are then encoded into your chosen format: hex (two lowercase hex digits per byte), base64 (standard RFC 4648 encoding), base64url (URL-safe variant replacing + with - and / with _), or a decimal byte array (JSON array of integers 0–255). Entropy is calculated as bytes × 8 bits.

Use cases

  • Generating salts for bcrypt, Argon2, or PBKDF2 before storing a new user password.
  • Creating unique per-row salts for a legacy MD5/SHA-1 password column migration.
  • Producing random nonce values for HMAC-based token generation.
  • Supplying test vectors of known entropy for security unit tests.
  • Teaching developers why salts prevent rainbow table attacks.

Frequently Asked Questions

Last updated: 2026-06-09 · Reviewed by Nham Vu