API Key Hasher
Hash API keys using SHA-256, SHA-512, or PBKDF2 before storing them in your database. Generates a Node.js verification snippet and shows the recommended storage format — all 100% client-side using the Web Crypto API.
How to Use API Key Hasher
How to Use the API Key Hasher
Step 1: Paste Your API Key
Enter or paste the API key you want to hash. Use the eye icon to toggle visibility. You can also click an example preset to test with a realistic-looking key.
Step 2: Choose an Algorithm
| Algorithm | Speed | Output | Best for |
|---|---|---|---|
| SHA-256 | Fast | 64 hex chars | Checksums, lookup indices, low-risk keys |
| SHA-512 | Fast | 128 hex chars | Longer keys, signing secrets, higher security |
| PBKDF2 | Slow (safe) | 64 hex chars | Credentials needing offline attack protection |
SHA-256 and SHA-512 are fast cryptographic hash functions. They are suitable when your main threat model is a database breach exposing stored keys, and the keys themselves have high entropy (randomly generated). They do not protect against GPU-based brute-force attacks if the key has low entropy.
PBKDF2 applies 100,000 iterations of HMAC-SHA256 to derive the hash. The high iteration count makes GPU cracking prohibitively expensive, similar to how bcrypt protects passwords. Use PBKDF2 when the API key might be reused as a password or when your keys have lower entropy.
Step 3: Add a Salt (Optional for SHA, Auto-generated for PBKDF2)
A salt is a random value mixed into the input before hashing. It prevents two identical keys from producing the same hash and defeats precomputed rainbow table attacks.
- For SHA-256 and SHA-512, the salt is optional. If provided, the tool hashes
salt:apiKeyand you store the salt separately. - For PBKDF2, a salt is mandatory. If you leave the field blank, the tool generates a cryptographically random 16-byte salt automatically.
Step 4: Click Hash Key
The tool outputs:
- The raw hex hash
- The full stored record string (algorithm prefix + salt + hash)
- A Node.js verification snippet using
timingSafeEqual
Step 5: Store and Verify
Store the hash in your database, never the original key. When a user presents a key for authentication, hash it with the same algorithm and salt, then compare using timingSafeEqual to prevent timing attacks.
Storage Format Reference
| Algorithm | Format |
|---|---|
| SHA-256 (no salt) | sha256:hexHash |
| SHA-256 (with salt) | sha256:salt:hexHash |
| SHA-512 (no salt) | sha512:hexHash |
| SHA-512 (with salt) | sha512:salt:hexHash |
| PBKDF2 | pbkdf2:100000:saltHex:hashHex |
Frequently Asked Questions
Most Viewed Tools
TOTP Code Generator
Generate time-based one-time passwords from a TOTP secret key. Enter your base32 secret, choose a period and digit length, and get the current and next codes with a live countdown timer. Useful for testing and debugging 2FA integrations.
Use Tool →Secret and Credential Scanner
Scan pasted text, code, or config files for accidentally exposed API keys, tokens, passwords, and private keys. Detects 50+ secret types across AWS, GitHub, Stripe, OpenAI, and more — all client-side, nothing leaves your browser.
Use Tool →Password Entropy Calculator
Calculate the information-theoretic bit entropy of any password or API key. Detects character set pools automatically, shows the total number of possible combinations, and estimates crack time across five attack scenarios from rate-limited web logins to GPU cracking clusters.
Use Tool →Content Security Policy Generator
Build Content Security Policy headers interactively. Toggle directives like script-src, style-src, and img-src, select allowed source tokens, and add custom origins. Instantly outputs your CSP as an HTTP header, meta tag, Nginx directive, or Apache header.
Use Tool →Screen Size Converter
Calculate screen width and height from diagonal size and aspect ratio. Convert between inches and centimeters for displays, TVs, and monitors with instant dimension calculations.
Use Tool →SSH Key Generator
Generate Ed25519 and RSA 4096-bit SSH key pairs entirely in your browser. Keys are never sent to any server — 100% client-side using the Web Crypto API.
Use Tool →PGP Key Generator
Generate PGP public and private key pairs for email encryption and code signing. Supports ECC (Curve25519) and RSA up to 4096-bit. Entirely browser-side — keys never leave your device.
Use Tool →DPI Calculator
Calculate DPI (dots per inch), image dimensions, and print sizes. Convert between pixels and physical dimensions for printing and displays.
Use Tool →Related Privacy & Security Tools
PGP Key Generator
Generate PGP public and private key pairs for email encryption and code signing. Supports ECC (Curve25519) and RSA up to 4096-bit. Entirely browser-side — keys never leave your device.
Use Tool →TOTP Code Generator
Generate time-based one-time passwords from a TOTP secret key. Enter your base32 secret, choose a period and digit length, and get the current and next codes with a live countdown timer. Useful for testing and debugging 2FA integrations.
Use Tool →OAuth 2.0 Scope Builder
Build and decode OAuth 2.0 scope strings for Google, GitHub, Stripe, and custom providers. Toggle permissions with risk indicators, generate ready-to-use scope strings, and decode existing scope strings to understand what access they grant.
Use Tool →Password Entropy Calculator
Calculate the information-theoretic bit entropy of any password or API key. Detects character set pools automatically, shows the total number of possible combinations, and estimates crack time across five attack scenarios from rate-limited web logins to GPU cracking clusters.
Use Tool →Content Security Policy Generator
Build Content Security Policy headers interactively. Toggle directives like script-src, style-src, and img-src, select allowed source tokens, and add custom origins. Instantly outputs your CSP as an HTTP header, meta tag, Nginx directive, or Apache header.
Use Tool →SSH Key Generator
Generate Ed25519 and RSA 4096-bit SSH key pairs entirely in your browser. Keys are never sent to any server — 100% client-side using the Web Crypto API.
Use Tool →Secret and Credential Scanner
Scan pasted text, code, or config files for accidentally exposed API keys, tokens, passwords, and private keys. Detects 50+ secret types across AWS, GitHub, Stripe, OpenAI, and more — all client-side, nothing leaves your browser.
Use Tool →API Key Generator
Generate secure, cryptographically random API keys for authentication and authorization. Create custom API keys with various formats including hex, base64, and prefixed keys.
Use Tool →Share Your Feedback
Help us improve this tool by sharing your experience