Fernet decrypt and encrypt
Runs in your browserPaste a Fernet token (gAAAAA…) and the key. You get the text and the time it was made; the HMAC is checked. Nothing leaves your browser.
More options
Paste the token and the key
Fernet tokens from Python (cryptography.fernet, also Airflow and Django apps). Rails credentials.yml.enc works too.
Text and key in, token out
Like Fernet(key).encrypt(text) in Python.
Start from an example
Each example fills in the tool above and decrypts it. All keys and passwords are demo values made for this page.
What is inside a Fernet token
| Bytes | What it is |
|---|---|
| 1 | Version 0x80 (Base64 starts with gAAAAA) |
| 2–9 | Time of creation, seconds since 1970 |
| 10–25 | IV, 16 bytes |
| 26–… | AES-128-CBC data |
| last 32 | HMAC-SHA256 over everything before |
The key is 32 bytes as URL-safe Base64: the first half signs (HMAC), the second half encrypts (AES-128). MultiFernet tries several keys in order; paste them one per line.
The same in Python
from cryptography.fernet import Fernet Fernet(key).decrypt(token) # bytes Fernet(key).decrypt(token, ttl=3600) # refuses older tokens
Fernet.generate_key()
EDITOR=cat bin/rails credentials:show RAILS_MASTER_KEY=… bin/rails credentials:show
Rails credentials
config/credentials.yml.enc is data--iv--tag: AES-128-GCM with the 32 hex characters of config/master.key (or RAILS_MASTER_KEY). Inside is the YAML, serialized with Ruby’s Marshal; the tool unpacks it.
Tested against the original tools
Every format on this page was checked against values made by the real tool, on 3 December 2026:
- Fernet tokens from Python cryptography, MultiFernet key lists, wrong keys; what the tool creates, Python decrypts.
- Rails credentials made with Ruby’s OpenSSL and Marshal as in ActiveSupport::EncryptedFile; what the tool creates, Ruby reads.
Other encrypted formats
Every format has its own page with the same tool. Paste anything into one of them: if it belongs elsewhere, the tool says so and takes it there.
Questions about Fernet
How do I decrypt a Fernet token?
Paste the token and the key above, or in Python: Fernet(key).decrypt(token).
What does InvalidToken mean?
The HMAC doesn’t match (wrong key, changed token) or, with ttl, the token is too old. The tool shows when it was made.
Can I tell when a token was created?
Yes, without the key: the time is in plain bytes 2 to 9. The tool shows it after decrypting.
Is it safe to paste the key here?
Everything runs in your browser: nothing you paste is sent anywhere, not even to this site. The page’s Content-Security-Policy blocks connections to other sites; check the Network tab of your browser’s developer tools.