Encrypting
Learn how Dotenvx encryption keeps secrets safe in source control.
Dotenvx encrypts secret values in .env files while keeping the file readable, reviewable, and safe to commit.
Start with a plaintext .env file.
# .env
HELLO="World"
Run dotenvx encrypt.
$ dotenvx encrypt
◈ encrypted (.env)The values become ciphertext, the keys stay readable, and a public encryption key is added to the file.
# .env
DOTENV_PUBLIC_KEY="0312770354c6661d9902a3a9e648b4599f71a8c365c132421b94e21fefcc7d9457"
HELLO="encrypted:BBLDHBFNnbfWt2A3PS8fzjEaLlZNB695T527ZrbF707xIv/OTmhnnxIr2bF07kr3npmgmrIcYm3dB/DOsKrptHLne06UlZpRh2AYNN/ITwdLGIom3HIZpOgc4cxs/jIXfsdgEghs"