Ansible Vault decrypt and encrypt
Runs in your browserPaste a vault file or a YAML file with !vault | variables and the vault password. Every variable is decrypted at once. Nothing leaves your browser.
Paste a vault file and the password
A whole file from ansible-vault encrypt, or a YAML file with name: !vault | variables. hiera-eyaml values and Chef data bags work too.
Like ansible-vault encrypt_string
With a variable name you get a block to paste into your vars file; without one, a whole vault file.
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.
How a vault file is built
A vault starts with a header line, then hex. Inside the hex are three lines of hex again: salt, HMAC and the encrypted data.
| Part | What it is |
|---|---|
$ANSIBLE_VAULT;1.1;AES256 | Format 1.1; 1.2 adds the vault ID: $ANSIBLE_VAULT;1.2;AES256;prod |
| Salt | 32 random bytes |
| Keys | PBKDF2-HMAC-SHA256 with 10,000 rounds: 32 bytes for AES, 32 for the HMAC, 16 for the counter |
| HMAC-SHA256 | Over the encrypted data. A wrong password is detected before anything is decrypted. |
| Data | AES-256-CTR, padded with PKCS#7 |
For variables, ansible-vault encrypt_string writes the same block, indented under name: !vault |. The tool finds all of them in a vars file and shows the file with the values in plain text.
The same with ansible-vault
ansible-vault view group_vars/all/vault.yml ansible-vault decrypt --output - group_vars/all/vault.yml
ansible localhost -m debug -a var=db_password -e @group_vars/all/vars.yml --ask-vault-pass
ansible-vault encrypt_string --name db_password 's3cr3t' ansible-vault encrypt_string --vault-id prod@prompt --name api_token 'tok-123'
ansible-vault rekey group_vars/all/vault.yml
When ansible-vault refuses
Wrong password, or the file needs a different vault ID. With several vault IDs, each variable may need its own password.
The hex lines under !vault | must be indented evenly. Copied from a chat or a web page, they often aren’t; the tool tolerates it, Ansible doesn’t.
encrypt_string from stdin includes the final newline. Use --stdin-name and printf, or check the decrypted value here.
Files from Ansible 1.x use plain AES (no AES256). Current Ansible can’t open them anymore.
hiera-eyaml and Chef data bags
hiera-eyaml (Puppet) writes ENC[PKCS7,…]: CMS with RSA key transport and AES-256-CBC. Paste values or a whole Hiera file and the private key keys/private_key.pkcs7.pem. Encrypting needs the certificate public_key.pkcs7.pem.
Chef encrypted data bags store each field as encrypted_data, iv and cipher (version 1 and 2: AES-256-CBC, version 3: AES-256-GCM). Paste the item as JSON (knife data bag show BAG ITEM -F json) and the secret from encrypted_data_bag_secret.
Tested against the original tools
Every format on this page was checked against values made by the real tool, on 3 December 2026:
- Vault files and encrypt_string variables made by ansible-vault (ansible-core 2.20), with and without vault ID, wrong passwords. What the tool encrypts, ansible-vault decrypts.
- hiera-eyaml: CMS from OpenSSL with AES-256 (the same call eyaml makes in Ruby), keys in PKCS#1 and PKCS#8; what the tool encrypts, OpenSSL and Ruby decrypt.
- Chef: data bag items version 1, 2 and 3 made with Ruby’s OpenSSL as in Chef’s encryptor.
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 Ansible Vault
How do I decrypt an Ansible Vault string?
Paste the vars file (or just the name: !vault | block) above and enter the vault password. In a terminal: ansible-vault view for files, or the debug module for a single variable.
Can I decrypt it without the password?
No. The HMAC check fails, and AES-256 can’t be guessed. If the password itself is weak, it can be guessed, which is why vault passwords should be long and random.
What is a vault ID?
A label (like prod or dev) for one of several vault passwords. Format 1.2 writes it into the header so Ansible knows which password to try first. It doesn’t change the encryption.
Is the variable name encrypted?
No, only the value. Anyone with the file sees which variables exist.
Is it safe to paste a vault 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.