# bcrypt

*noun*

say it: **“BEE-kript”** **/ˈbiˌkrɪpt/**

A password-hashing method that adds a random salt and is deliberately slow, so stolen password hashes are hard to crack.

## What is **bcrypt**?

**bcrypt** is a way to hash passwords that mixes in a random salt and is slow on purpose, set by a cost factor. A server stores only the hash and checks a sign-in with `compare`, and stolen hashes are slow to guess against.

```javascript
import bcrypt from "bcryptjs";

const hash = await bcrypt.hash("tulip-garden-42", 12); // 12 = cost factor
console.log(await bcrypt.compare("tulip-garden-42", hash)); // true
console.log(await bcrypt.compare("tulip", hash));           // false
```

## In a sentence

- “Raising **bcrypt**'s cost factor from 10 to 12 makes each guess four times slower.”
- “The sign-up route stores a **bcrypt** hash of each password, never the password itself.”

Level: Journeyman · [More Web Development terms at this level](https://www.ask-codey.com/glossary?category=web-development&level=3)

Updated: November 19, 2026

Source: https://www.ask-codey.com/glossary/bcrypt
