Rails secret_key_base Generator
128 hex characters from 64 random bytes, in exactly the format Rails expects.
Very strong0 bitsGenerated in your browser
Local alternative
rails secretPrefer generating secrets on the machine that uses them? This command produces an equivalent value.
Official documentationRails derives every other key from secret_key_base, including those for signed cookies and Active Record Encryption. In development the value lives in credentials, in production usually in an environment variable. Rotating it invalidates existing signed cookies and signs every user out.
Frequently asked questions
Into the SECRET_KEY_BASE environment variable or your application's encrypted credentials. In production Rails does not set the value itself — without it, the application will not boot.
Rails derives several keys from this base value, among them the ones for signed and encrypted cookies. 64 random bytes, written as 128 hex characters, match what rails secret produces.
All signed and encrypted cookies become invalid, so users are signed out. Encrypted credentials are unaffected — they hang off a separate master key.