KeyForge

Random secret generator

Generate a 64-byte (512-bit) cryptographic secret as hex. Use it for Django SECRET_KEY, Rails secret_key_base, webhook signing secrets, or any app that needs a strong random key.

About random secrets

64 bytes, 512 bits of entropy

Why 64 bytes?

64 bytes (512 bits) matches the recommendation for Django’s SECRET_KEY, Rails’ secret_key_base, and similar application frameworks. It provides more than enough entropy to resist brute-force attacks for the foreseeable future — many frameworks require at least this much or will warn you at startup.

What to use it for

Application secret keys (Django, Rails, Phoenix, Laravel), webhook signing secrets (Stripe, GitHub, Slack), session encryption keys, CSRF secret keys, and any environment where a framework or service asks you to generate a random secret. Paste it directly into your .env or secrets manager.

Local and private

Because generation happens entirely in your browser, the secret never touches a network. You can generate your production secret_key_base without trusting a third-party server — the bytes come straight from crypto.getRandomValues.

FAQ

about random secret generation
What is a random secret?

A random secret is a long, unpredictable string used to sign sessions, encrypt cookies, or authenticate webhook requests. Frameworks like Django and Rails generate one automatically on project creation, but you may need to regenerate it.

How many bytes do I need for SECRET_KEY?

Django 4.0+ requires at least 64 bytes. Rails secret_key_base defaults to 128 bytes. 64 bytes of hex output (128 characters) is a safe default for most application frameworks.

Can I generate a secret for Django?

Yes. Use 64 bytes (or change to 128 in the Size field) and Django will accept it directly as your SECRET_KEY. The output is a lower-case hex string, which matches Django's expected format.

Are secrets generated here safe for production?

Yes. The secret is generated from crypto.getRandomValues, the same cryptographic source your browser uses for secure connections. Since it never leaves your device, there's no exposure risk from network transmission.

More KeyForge generators

pick a variant

UUID V4

Generate random UUID v4 identifiers straight from crypto.randomUUID. RFC 4122 compliant, one or many

Free Open

Hex Token

Generate cryptographically-random hex strings from the Web Crypto API. Choose the byte length, optio

Free Open

Base64URL Token

Generate cryptographically-random Base64URL tokens from the Web Crypto API. URL-safe, no padding, gr

Free Open

API Key Generator

Generate random alphanumeric API keys and secrets. Set a custom prefix to match your service's forma

Free Open

Questions or feedback?

a reply within 2 business days

Spotted a bug, want a feature, or just have feedback on KeyForge? Send us a note and we will get back to you.

Prefer to talk it through? Book a 30-min call →