{
 "kind": "tool",
 "slug": "bcryptjs",
 "path": "tools/bcryptjs/",
 "name": "bcryptjs",
 "maker": null,
 "density": "profile",
 "crumbs": [
  [
   "Tools",
   "tools/"
  ],
  [
   "Auth and security libraries",
   "tools/auth-security/"
  ]
 ],
 "lead": "Pure JavaScript bcrypt implementation for secure password hashing without dependencies.",
 "chips": [
  {
   "label": "Auth and security libraries",
   "path": "tools/auth-security/"
  },
  {
   "label": "NPM"
  }
 ],
 "primary": {
  "label": "Copy install command",
  "copy": "npm install bcryptjs"
 },
 "links": [
  {
   "label": "GitHub",
   "href": "https://github.com/dcodeIO/bcrypt.js"
  },
  {
   "label": "Website",
   "href": "https://github.com/dcodeIO/bcrypt.js#readme"
  }
 ],
 "track": "New versions, deprecation and license changes on your dashboard",
 "verdicts": [
  {
   "key": "license",
   "label": "License",
   "value": "BSD-3-Clause",
   "status": "yes",
   "sub": "Use it in paid apps",
   "quote": null,
   "note": "License from npm.",
   "src": "https://github.com/dcodeIO/bcrypt.js"
  },
  {
   "key": "maint",
   "label": "Maintained",
   "value": "Maintained",
   "status": "yes",
   "sub": "Last change Oct 1, 2026",
   "note": "Latest GitHub release Nov 2, 2025. ",
   "src": "https://github.com/dcodeIO/bcrypt.js"
  },
  {
   "key": "pop",
   "label": "Used by agents' projects",
   "value": "196 projects",
   "status": "info",
   "sub": "#1 of 141 in its category",
   "note": "Dependency in 196 public GitHub projects set up for AI coding agents that we scanned (3.1%).",
   "src": null
  },
  {
   "key": "agent",
   "label": "Agent access",
   "value": "Install only",
   "status": "info",
   "sub": null,
   "note": "Agent skills for this library in the skills catalog; community skills are written by others, read them before you install.",
   "src": null
  }
 ],
 "vfoot": "From the package registry and GitHub, checked daily.",
 "blocks": [
  {
   "id": "overview",
   "nav": "Overview",
   "h2": "What bcryptjs does",
   "parts": [
    {
     "t": "prose",
     "text": "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."
    }
   ]
  },
  {
   "id": "popularity",
   "nav": "Popularity",
   "h2": "bcryptjs popularity",
   "parts": [
    {
     "t": "stats",
     "items": [
      {
       "n": "69",
       "of": "/ 100",
       "l": "Gid Score, #413 overall"
      },
      {
       "n": "19.9M",
       "l": "downloads a week, npm"
      },
      {
       "n": "3,795",
       "l": "GitHub stars"
      },
      {
       "n": "196",
       "l": "agent projects use it"
      }
     ]
    },
    {
     "t": "small",
     "text": "Gid Score measures public popularity and activity, not quality.",
     "link": "How the Gid Score is calculated",
     "path": "tools/top/"
    }
   ]
  },
  {
   "id": "usage",
   "nav": "How it is used",
   "h2": "How bcryptjs is used",
   "parts": [
    {
     "t": "list",
     "items": [
      "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%)."
     ]
    },
    {
     "t": "h3",
     "text": "By coding agent"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "115 projects, 3.5%",
       "v": "Claude Code",
       "path": "agents/claude-code/"
      },
      {
       "l": "106 projects, 3.5%",
       "v": "GitHub Copilot",
       "path": "agents/github-copilot/"
      },
      {
       "l": "80 projects, 3.3%",
       "v": "Cursor",
       "path": "agents/cursor/"
      },
      {
       "l": "19 projects, 4.0%",
       "v": "Gemini CLI",
       "path": "agents/gemini-cli/"
      },
      {
       "l": "13 projects, 2.8%",
       "v": "OpenAI Codex",
       "path": "agents/openai-codex/"
      },
      {
       "l": "11 projects, 3.9%",
       "v": "Devin Desktop",
       "path": "agents/devin-desktop/"
      },
      {
       "l": "10 projects, 3.0%",
       "v": "OpenClaw",
       "path": "agents/openclaw/"
      },
      {
       "l": "10 projects, 2.9%",
       "v": "OpenCode",
       "path": "agents/opencode/"
      }
     ]
    },
    {
     "t": "h3",
     "text": "Often used with"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "In 70.9% of its projects",
       "v": "Next.js",
       "path": "tools/next/"
      },
      {
       "l": "In 68.4% of its projects",
       "v": "Lucide React",
       "path": "tools/lucide-react/"
      },
      {
       "l": "In 84.7% of its projects",
       "v": "React",
       "path": "tools/react/"
      },
      {
       "l": "In 81.6% of its projects",
       "v": "Tailwind CSS",
       "path": "tools/tailwindcss/"
      },
      {
       "l": "In 62.2% of its projects",
       "v": "clsx",
       "path": "tools/clsx/"
      },
      {
       "l": "In 47.4% of its projects",
       "v": "Recharts",
       "path": "tools/recharts/"
      },
      {
       "l": "In 53.6% of its projects",
       "v": "dotenv",
       "path": "tools/dotenv/"
      },
      {
       "l": "In 58.7% of its projects",
       "v": "Tailwind Merge",
       "path": "tools/tailwind-merge/"
      }
     ]
    }
   ]
  },
  {
   "id": "profile",
   "nav": "Profile",
   "h2": "bcryptjs in practice",
   "parts": [
    {
     "t": "h3",
     "text": "Strengths"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "Node.js binding compatible, browser too",
       "v": "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."
      },
      {
       "l": "Matches the binding on length checks",
       "v": "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>."
      },
      {
       "l": "Async work runs in chunks",
       "v": "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."
      },
      {
       "l": "Progress reporting on hash and compare",
       "v": "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."
      }
     ]
    },
    {
     "t": "h3",
     "text": "Watch out for"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "README puts it about 30% slower",
       "v": "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."
      },
      {
       "l": "Input past 72 bytes is truncated",
       "v": "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."
      },
      {
       "l": "Browser ESM needs a crypto stub",
       "v": "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."
      }
     ]
    },
    {
     "t": "h3",
     "text": "Hash and check a password (async)"
    },
    {
     "t": "tabs",
     "label": "Example",
     "items": [
      {
       "tab": "Ts",
       "code": "import bcrypt from \"bcryptjs\";\n\nconst salt = await bcrypt.genSalt(10);\nconst hash = await bcrypt.hash(\"B4c0/\\/\", salt);\n// Store hash in your password DB\n\n// Load hash from your password DB\nawait bcrypt.compare(\"B4c0/\\/\", hash); // true\nawait bcrypt.compare(\"not_bacon\", hash); // false"
      }
     ]
    }
   ]
  },
  {
   "id": "more",
   "nav": null,
   "spy_as": "profile",
   "h2": "More about bcryptjs",
   "parts": [
    {
     "t": "more",
     "items": [
      {
       "title": "Funding",
       "path": "tools/funding/",
       "items": [
        "GitHub Sponsors: https://github.com/dcodeIO",
        "1 GitHub sponsors"
       ]
      },
      {
       "title": "Head to head",
       "items": [
        {
         "text": "bcryptjs vs bcrypt (JavaScript)",
         "note": "used together in 9 projects",
         "path": "tools/compare/bcryptjs-vs-bcrypt-javascript/"
        }
       ]
      },
      {
       "title": "Packages around it",
       "items": [
        "zod: Schema validation",
        "next: React framework",
        "lucide-react: Icon set",
        "dotenv: Env file loader",
        "clsx: Class name helper",
        "tailwind-merge: Tailwind class merging"
       ]
      },
      {
       "title": "More in Auth and security libraries",
       "path": "tools/auth-security/",
       "items": [
        {
         "text": "NextAuth.js",
         "path": "tools/next-auth/"
        },
        {
         "text": "jsonwebtoken",
         "path": "tools/jsonwebtoken/"
        },
        {
         "text": "cryptography",
         "path": "tools/cryptography/"
        },
        {
         "text": "PyJWT",
         "path": "tools/pyjwt/"
        },
        {
         "text": "jose",
         "path": "tools/jose/"
        },
        {
         "text": "Better Auth",
         "path": "tools/better-auth/"
        },
        {
         "text": "DOMPurify",
         "path": "tools/dompurify/"
        },
        {
         "text": "Helmet",
         "path": "tools/helmet/"
        }
       ]
      }
     ]
    }
   ]
  },
  {
   "id": "alternatives",
   "nav": "Alternatives",
   "h2": "Alternatives",
   "parts": [
    {
     "t": "alts",
     "items": [
      {
       "name": "bcryptjs",
       "me": true,
       "facts": [
        "BSD-3-Clause",
        "Gid 69",
        "19.9M/wk"
       ]
      },
      {
       "name": "bcrypt (JavaScript)",
       "why": "Password hashing library for secure credential storage in Node.js applications.",
       "path": "tools/bcrypt-npm/",
       "facts": [
        "MIT",
        "Gid 66",
        "8.3M/wk"
       ]
      }
     ],
     "more": "Compare bcryptjs with another tool",
     "more_path": "tools/compare/"
    }
   ]
  },
  {
   "id": "start",
   "nav": "Get started",
   "h2": "Get started",
   "parts": [
    {
     "t": "install",
     "intro": "Install it.",
     "code": "npm install bcryptjs"
    },
    {
     "t": "h3",
     "text": "Rules for your agent"
    },
    {
     "t": "rules",
     "label": "Paste into AGENTS.md or CLAUDE.md",
     "text": "## bcryptjs\n- Import with `import bcrypt from \"bcryptjs\";`. The package exports an ES module with a UMD fallback.\n- 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.\n- Generated hashes are 60 characters long. Rounds default to 10 when omitted in `genSalt`, `genSaltSync` and `hashSync`.\n- From a CDN, replace `TAG`/`VERSION` with a specific version. The README says omitting it to get the latest is not recommended in production.\n- 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.\n- `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.\n- `getSalt` does not validate the hash it reads from.\n"
    }
   ]
  }
 ],
 "glance": [
  [
   "Package",
   "npm bcryptjs"
  ],
  [
   "Category",
   "Auth and security libraries"
  ],
  [
   "License",
   "BSD-3-Clause"
  ],
  [
   "Latest version",
   "v3.0.3, November 2, 2025"
  ],
  [
   "On GitHub since",
   "May 2013"
  ],
  [
   "Gid Score",
   "69.4"
  ],
  [
   "Rank in category",
   "#1 of 141"
  ],
  [
   "GitHub",
   "dcodeIO/bcrypt.js"
  ],
  [
   "Last change",
   "Oct 1, 2026"
  ]
 ],
 "good": [],
 "checked_line": "From the package registry, GitHub and our scan of public agent projects; numbers update daily.",
 "logo": "https://agentgid.com/media/avatars/dcodeio.png"
}