Django SECRET_KEY Generator

50 characters from Django’s own alphabet, identical to get_random_secret_key().

Very strong0 bitsGenerated in your browser

Local alternative

python -c "from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())"

Prefer generating secrets on the machine that uses them? This command produces an equivalent value.

Official documentation

Django uses the SECRET_KEY for session signatures, CSRF tokens and password reset links. It draws from a fixed 50-character alphabet: lowercase letters, digits and a set of symbols, but no uppercase letters. Rotating it invalidates all sessions and any outstanding reset links.

Frequently asked questions