bcrypt Generator & Verifier
Generate bcrypt hashes with random salts, or verify an existing hash. Check the UTF-8 byte limit and choose an explicit cost.
Generate or verify one password
Generate returns a standard $2a$ bcrypt string, including the cost and salt. Verify reads its parameters from an existing $2a$, $2b$ or $2y$ string and returns a boolean. It does not return the password. A mismatch is a successful verification operation with matches=false.
The default cost is 12 and the default salt is 16 cryptographically random bytes. A custom salt must contain exactly 32 hexadecimal digits; reuse it only when reproducing a test vector or an existing system. Costs below 10 show a diagnostic.
The 72-byte boundary
The password is UTF-8 encoded, without trimming or normalization. This tool rejects input over 72 bytes instead of silently truncating it; a Chinese character commonly occupies three bytes. Empty passwords and embedded NUL bytes are supported. These cases use the compatible bcryptjs engine, avoiding the WASM wrapper’s empty-input restriction and NUL truncation.
This browser tool caps generation and verification costs at 16 and runs in a cancellable Worker with a 30-second deadline. These are browser resource limits, not limits of the bcrypt format. Benchmark your production authentication service separately.
Questions & answers
Can bcrypt decrypt a password?
No. It is a password hash. Verification recomputes the function using a candidate password and compares the result.
Why does a Chinese password reach the limit sooner?
The limit counts encoded bytes, not displayed characters. The tool checks the actual UTF-8 byte length.
Is my input uploaded?
No. Processing runs in your browser. Engines load from this site; the tool does not send input to a processing API or save it. Clear removes the visible input and result.
Other Languages
References
How we make sure
We check this tool with the automated test suites linked below. Example checks are shown in their original language.
- Verification method
- Check fixed-salt hashes, empty/UTF-8/NUL passwords, compatible prefixes and byte-length boundaries against independently generated hashes.
- Comparison reference
- A fixed NUL fixture from Python bcrypt 5.0.0 and a known empty-password digest; the page uses bcryptjs.
- Verification scope
- These samples and boundaries do not prove correctness for every input.
Test source and cases (select a file to read it)
-
security-tools.test.js
- bcrypt supports empty input, UTF-8, standard prefixes, exact byte limits and mismatches
- bcrypt random salts produce different verifiable results without a plaintext report
- bcrypt does not truncate embedded NULs and matches Python bcrypt 5.0.0 byte-for-byte
These checks cover the listed examples and boundaries, not every possible input. Round trips and checks using the same library are not independent verification.