Skip to content
Agents tracked: 506 Releases (7d): 634 Agent status: 3 with issuesSince last limit reset: Claude 15d · Codex 0d For AI agents: Markdown Updated Nov 26, 2026

bcryptjs

Pure JavaScript bcrypt implementation for secure password hashing without dependencies.

Auth and security librariesNPM

GitHubWebsite

1. License

License from npm.

github.com/dcodeIO/bcrypt.js

From the package registry and GitHub, checked daily. Tap a verdict to see its source.How we checkedReport an error

What bcryptjs does

bcryptjs is bcrypt rewritten in pure JavaScript with zero dependencies: the README says it stays compatible with the C++ binding on Node.js and also works in the browser, and says plainly that it is slower for it.

bcryptjs popularity

69 / 100
Gid Score, #413 overall
19.9M
downloads a week, npm
3,795
GitHub stars
196
agent projects use it
bcryptjs: downloads per weeknpm, bcryptjs 19,900,490
bcryptjs: GitHub starsdcodeIO/bcrypt.js 3,795

Gid Score measures public popularity and activity, not quality. How the Gid Score is calculated

How bcryptjs is used

  • bcryptjs is a dependency in 196 of the 6,258 public GitHub projects set up for AI coding agents that we scanned (4.0% of the 4,867 JavaScript/TypeScript ones), #1 of 141 in auth and security libraries.
  • Counting the projects our scan samples by dependency (Solana 3,067, Ethereum and EVM 1,774, 3D and games 3,130, agent frameworks and SDKs 13,750), it appears in 505; those are left out of every share on this page.
  • The most used alternative in our scan is bcrypt (JavaScript) (64 projects).
  • Projects that use it most often also use Next.js (70.9%), Lucide React (68.4%), React (84.7%).

By coding agent

115 projects, 3.5%
106 projects, 3.5%
80 projects, 3.3%
19 projects, 4.0%
13 projects, 2.8%
11 projects, 3.9%
10 projects, 3.0%
10 projects, 2.9%

Often used with

In 70.9% of its projects
In 68.4% of its projects
In 84.7% of its projects
In 81.6% of its projects
In 62.2% of its projects
In 47.4% of its projects
In 53.6% of its projects
In 58.7% of its projects

bcryptjs in practice

Strengths

Node.js binding compatible, browser too

The README claims compatibility with the C++ <code>bcrypt</code> binding on Node.js. In the same sentence it says the library also works in the browser.

Matches the binding on length checks

The library does not check the 72-byte input limit implicitly. The README gives the reason: "for compatibility with the C++ binding on Node.js". It leaves the check to <code>bcrypt.truncates(password)</code>.

Async work runs in chunks

The README says the async APIs split an operation into small chunks. Each next chunk goes to the back of the JS event queue, so other computation can run in between.

Progress reporting on hash and compare

The callback versions of <code>hash</code> and <code>compare</code> accept an optional <code>ProgressCallback</code>. It reports the share of rounds completed as a number from 0.0 to 1.0.

Watch out for

README puts it about 30% slower

The README says the library is slower than the C++ binding because it is pure JavaScript, "about 30%" by its linked benchmark. It notes this effectively reduces the number of iterations you can process in the same time.

Input past 72 bytes is truncated

A password longer than 72 bytes in UTF-8 is truncated when hashed. <code>bcrypt.truncates(password)</code> tells you in advance whether that will happen.

Browser ESM needs a crypto stub

If you load the ESM build directly in a browser, you have to stub out the <code>crypto</code> import, for example with an import map. The README says bundlers should omit it automatically.

Hash and check a password (async)

import bcrypt from "bcryptjs";

const salt = await bcrypt.genSalt(10);
const hash = await bcrypt.hash("B4c0/\/", salt);
// Store hash in your password DB

// Load hash from your password DB
await bcrypt.compare("B4c0/\/", hash); // true
await bcrypt.compare("not_bacon", hash); // false

More about bcryptjs

Funding
  • GitHub Sponsors: https://github.com/dcodeIO
  • 1 GitHub sponsors

See all

Head to head
Packages around it
  • zod: Schema validation
  • next: React framework
  • lucide-react: Icon set
  • dotenv: Env file loader
  • clsx: Class name helper
  • tailwind-merge: Tailwind class merging
More in Auth and security libraries

Alternatives

bcryptjs This page

BSD-3-ClauseGid 6919.9M/wk

bcrypt (JavaScript)

Password hashing library for secure credential storage in Node.js applications.

MITGid 668.3M/wk

Compare bcryptjs with another tool

Get started

Install it.

npm install bcryptjs

Rules for your agent

Paste into AGENTS.md or CLAUDE.md
## bcryptjs
- Import with `import bcrypt from "bcryptjs";`. The package exports an ES module with a UMD fallback.
- Input longer than 72 bytes in UTF-8 is truncated when hashed. The library does not check this implicitly, so call `bcrypt.truncates(password)` where necessary.
- Generated hashes are 60 characters long. Rounds default to 10 when omitted in `genSalt`, `genSaltSync` and `hashSync`.
- From a CDN, replace `TAG`/`VERSION` with a specific version. The README says omitting it to get the latest is not recommended in production.
- When using the ESM build directly in a browser, stub out the `crypto` import, for example with an import map. Bundlers should omit it automatically.
- `setRandomFallback` is only needed when neither Web Crypto nor Node.js `crypto` is available. The PRNG you pass must be cryptographically secure and seeded properly.
- `getSalt` does not validate the hash it reads from.