.env · security🔥 popular🔒 100% client-side — never leaves your browser

Encrypt .env Files with a Passphrase (AES-256-GCM)

Encrypt a .env file before you send it: this .env encryption tool turns the whole file into one ENVTOOLS:v2: text blob with AES-256-GCM and a passphrase, so you can share secrets through chat, email or a ticket and decrypt them on the other side, in the browser or with a 15-line Node.js script.

By Aliniyaz Mamat · last reviewed

Be the first to rate
# click Encrypt to produce output
AES-256-GCM · PBKDF2-SHA256 600,000 iterations · runs in your browser

Key takeaways

  • ✓AES-256-GCM with a key derived by PBKDF2-SHA256 at 600,000 iterations (OWASP's recommendation for SHA-256). Older v1 blobs (210,000 iterations) still decrypt.
  • ✓A new random 16-byte salt and 12-byte IV per encryption: the same file encrypts differently every time.
  • ✓GCM authenticates the data: a wrong passphrase or a changed character fails loudly instead of returning garbage.
  • ✓The blob is only as strong as the passphrase. Use 5+ random words and send the passphrase over a different channel than the blob.
  • ✓Everything runs in your browser via the Web Crypto API; neither the .env nor the passphrase is sent anywhere.

What it does

  • ▸Encrypt and decrypt a whole .env with one passphrase
  • ▸AES-256-GCM + PBKDF2-SHA256 (600,000 iterations)
  • ▸Single-line ENVTOOLS:v2: output, safe to paste anywhere
  • ▸Decryptable without this site (Node.js script below)
  • ▸100% client-side, Web Crypto API

Privacy

Runs 100% in your browser. Your .env never touches our servers.

client-side only

When to use this tool

  • →Handing a new teammate the local .env without pasting secrets into Slack in plain text
  • →Sending credentials to a freelancer or agency once
  • →Keeping an encrypted backup of a .env in a password manager note or a private repo
  • →Moving a .env between your own machines through an untrusted channel

Common mistakes

  • ⚠Sending blob and passphrase in the same message. Anyone with the chat history can then decrypt it
  • ⚠A short passphrase like summer2026: PBKDF2 slows guessing, it doesn't make a weak passphrase strong
  • ⚠Using it as a long-term secrets store for a team: there is no access control, rotation or audit log. That is what a secrets manager is for
  • ⚠Forgetting that the recipient now has the plain .env. Rotate secrets when the person no longer needs them

How the encryption works

  1. A random 16-byte salt and 12-byte IV are generated with crypto.getRandomValues.
  2. The passphrase is stretched into a 256-bit key with PBKDF2-HMAC-SHA256, 600,000 iterations and the salt.
  3. The .env text is encrypted with AES-256-GCM, which appends a 16-byte authentication tag.
  4. Output: ENVTOOLS:v2: + base64url(salt ‖ IV ‖ ciphertext ‖ tag), one line of text.
FormatKDFIterationsStatus
ENVTOOLS:v2:PBKDF2-SHA256600,000current, created by this page
ENVTOOLS:v1:PBKDF2-SHA256210,000older blobs, still decrypted

Decrypting without this website

The format uses only standard primitives, so you are never locked in. This Node.js script (no dependencies) decrypts both versions:

decrypt-envtools.mjs
// usage: ENVTOOLS_PASSPHRASE='…' node decrypt-envtools.mjs secret.txt > .env
import { readFileSync } from "node:fs";
import { pbkdf2Sync, createDecipheriv } from "node:crypto";

const blob = readFileSync(process.argv[2], "utf8").trim();
const [, version, data] = blob.match(/^ENVTOOLS:(v1|v2):(.+)$/) ?? [];
if (!data) throw new Error("not an ENVTOOLS blob");
const buf = Buffer.from(data, "base64url");
const salt = buf.subarray(0, 16), iv = buf.subarray(16, 28);
const tag = buf.subarray(buf.length - 16), ct = buf.subarray(28, buf.length - 16);
const iterations = version === "v2" ? 600_000 : 210_000;
const key = pbkdf2Sync(process.env.ENVTOOLS_PASSPHRASE, salt, iterations, 32, "sha256");
const d = createDecipheriv("aes-256-gcm", key, iv);
d.setAuthTag(tag);
process.stdout.write(Buffer.concat([d.update(ct), d.final()]).toString("utf8"));

Passing the passphrase through an environment variable keeps it out of your shell history (prefix the command with a space in bash/zsh with HISTCONTROL=ignorespace).

Other ways to encrypt .env files

ToolHow it worksGood for
This pagepassphrase, one blobone-off sharing, no install
SOPS + ageencrypts values in place, keys per recipientcommitting encrypted .env files to git
dotenvxencrypted .env with a private key per environmentteams that want encrypted files in the repo
age / gpgencrypt any file to a recipient's public keysharing without a shared passphrase
Secrets manager (Vault, Doppler, Infisical, AWS/GCP)central store, access control, audit, rotationteams and production

The comparison dotenv vs secrets manager explains when a .env file stops being enough. Before encrypting, run the file through the ENV leak checker to see which values are real secrets.

Frequently asked questions

What encryption is used?

AES-256-GCM from the browser's Web Crypto API. The key comes from your passphrase via PBKDF2-HMAC-SHA256 with 600,000 iterations and a random 16-byte salt; each encryption uses a fresh 12-byte IV.

Can I decrypt the output without this tool?

Yes. Use the Node.js script above, or any AES-256-GCM implementation: the blob contains salt, IV, ciphertext and tag in that order after the ENVTOOLS:v2: prefix.

Is the passphrase stored or sent anywhere?

No. It is only used in your browser to derive the key. Lose it and the blob cannot be recovered, by anyone.

How strong should the passphrase be?

At least 5 random words or 16+ random characters. 600,000 PBKDF2 iterations make each guess slow, but a guessable passphrase still falls to a dictionary attack.

Is this a replacement for a secrets manager?

No. It is for moving a .env safely from A to B. For ongoing team access, rotation and audit logs, use a secrets manager.

Related tools

Learn more

coming soon

Get notified when env syncing launches

We're building a tiny tool to keep .env files in sync across teammates and environments. Leave your email — no spam, just a single launch ping.

We use your address only for this launch email. You can ask us to delete it at any time. Privacy policy