---
title: "Rails secret_key_base Generator – pwgen.de"
description: "128 hex characters from 64 random bytes, in exactly the format Rails expects."
canonical_url: "https://pwgen.de/en/rails-secret-key-generator"
meta:
  "og:description": "128 hex characters from 64 random bytes, in exactly the format Rails expects."
  "og:image": "https://pwgen.de/_og/s/o_5b9134cf9c8caf74.png"
  "og:image:height": "630"
  "og:image:type": image/png
  "og:image:width": "1200"
  "og:title": "Rails secret_key_base Generator – pwgen.de"
  "twitter:image": "https://pwgen.de/_og/s/o_5b9134cf9c8caf74.png"
---

> Index of every page on this site: [llms.txt](https://pwgen.de/llms.txt)

# **Rails secret\_key\_base Generator**

128 hex characters from 64 random bytes, in exactly the format Rails expects.

Very strong**0 bits**Generated in your browser

## **Local alternative**

`rails secret`

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

[Official documentation](https://guides.rubyonrails.org/security.html)

Rails 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.

```json
{"@context":"https://schema.org","@graph":[{"@id":"https://pwgen.de/en#website","@type":"WebSite","description":"Kostenloser, datenschutzfreundlicher Passwort-Generator. Generierung direkt im Browser – keine Passwörter werden gespeichert.","inLanguage":"en-US","name":"pwgen.de","url":"https://pwgen.de/en","publisher":{"@id":"https://pwgen.de/#identity"},"translationOfWork":{"@id":"https://pwgen.de/#website"}},{"@id":"https://pwgen.de/en/rails-secret-key-generator#webpage","description":"128 hex characters from 64 random bytes, in exactly the format Rails expects.","name":"Rails secret_key_base Generator","url":"https://pwgen.de/en/rails-secret-key-generator","@type":["WebPage","FAQPage"],"breadcrumb":{"@id":"https://pwgen.de/en/rails-secret-key-generator#breadcrumb"},"isPartOf":{"@id":"https://pwgen.de/en#website"},"mainEntity":[{"@id":"https://pwgen.de/en/rails-secret-key-generator#/schema/question/1"},{"@id":"https://pwgen.de/en/rails-secret-key-generator#/schema/question/2"},{"@id":"https://pwgen.de/en/rails-secret-key-generator#/schema/question/3"}],"potentialAction":[{"@type":"ReadAction","target":["https://pwgen.de/en/rails-secret-key-generator"]}],"primaryImageOfPage":{"@id":"https://pwgen.de/#logo"}},{"@id":"https://pwgen.de/#identity","@type":"Organization","email":"info@htrs.io","legalName":"GbR HTRS i/o","name":"HTRS i/o","telephone":"+49 221 292 513 03","url":"https://pwgen.de","vatID":"DE359532582","address":{"@type":"PostalAddress","streetAddress":"Gotenring 9","addressLocality":"Köln","postalCode":"50679","addressCountry":"DE"},"logo":{"@id":"https://pwgen.de/#logo"},"sameAs":["https://htrs.io"]},{"@id":"https://pwgen.de/en/rails-secret-key-generator#/schema/software-application/1","@type":"SoftwareApplication","applicationCategory":"DeveloperApplication","name":"pwgen.de – Rails secret_key_base Generator","operatingSystem":"Web Browser","offers":{"@type":"Offer","availability":"https://schema.org/InStock","price":"0","priceCurrency":"EUR","priceValidUntil":"2027-12-30T00:00:00.000Z"}},{"@id":"https://pwgen.de/en/rails-secret-key-generator#breadcrumb","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","name":"pwgen.de","item":"https://pwgen.de/en","position":1},{"@type":"ListItem","name":"Secrets","item":"https://pwgen.de/en/secrets","position":2},{"@type":"ListItem","name":"Rails secret_key_base Generator","position":3}]},{"@id":"https://pwgen.de/en/rails-secret-key-generator#/schema/question/1","@type":"Question","inLanguage":"en","name":"Where does SECRET_KEY_BASE go?","acceptedAnswer":{"@type":"Answer","text":"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."}},{"@id":"https://pwgen.de/en/rails-secret-key-generator#/schema/question/2","@type":"Question","inLanguage":"en","name":"Why 64 bytes in hex?","acceptedAnswer":{"@type":"Answer","text":"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."}},{"@id":"https://pwgen.de/en/rails-secret-key-generator#/schema/question/3","@type":"Question","inLanguage":"en","name":"What breaks on rotation?","acceptedAnswer":{"@type":"Answer","text":"All signed and encrypted cookies become invalid, so users are signed out. Encrypted credentials are unaffected — they hang off a separate master key."}},{"@id":"https://pwgen.de/#logo","@type":"ImageObject","caption":"HTRS i/o","contentUrl":"https://pwgen.de/apple-touch-icon.png","inLanguage":"en","url":"https://pwgen.de/apple-touch-icon.png"}]}
```

## Sitemap

See the full [sitemap](https://pwgen.de/sitemap.md) for all pages.
