Skip to content
ToolHub

Secret Key Generator

Generate random 128- to 512-bit keys in hex or Base64.

🔐
SecureTools Pro
Security Tools · Web Crypto API
🔐 Result
—
—
History 0
📋
No activity yet
Your history will appear here

About the Secret Key Generator

The Secret Key Generator creates random bytes for application secrets: JWT signing secrets, encryption keys, cookie and session secrets, and webhook signing keys. Choose 16, 24, 32, 48 or 64 bytes (128 to 512 bits) and an output format of hex, Base64, Base64 URL-safe or printable ASCII.

How to use the Secret Key Generator

  1. Choose the key size; 32 bytes (256-bit) is a common default.
  2. Choose the format your application expects.
  3. Copy the key into your environment variables or secrets manager.

Example

Laravel APP_KEY style

A 32-byte key in Base64 is 44 characters long, the format Laravel uses after the base64: prefix.

Frequently asked questions

Where should I store secret keys?

In environment variables or a secrets manager, never in source code or a public repository.

How big should the key be?

256 bits (32 bytes) suits most symmetric encryption and HMAC uses.

Can I regenerate a lost key?

No. Random keys cannot be recreated; data encrypted with a lost key cannot be decrypted.

Use ↑ ↓ to move, Enter to open.