openssl_encrypt Online
Test PHP's openssl_encrypt() function online using real PHP 8.2. Encrypt data using various cipher methods like AES-256-CBC, AES-128-GCM, and more.
openssl_encrypt(string $data, string $cipher_algo, string $passphrase, int $options = 0, string $iv = "", string &$tag = null, string $aad = "", int $tag_length = 16): string|false Cipher Method
Select the encryption algorithm
Passphrase / Key
The secret key for encryption
Data to Encrypt
The plaintext message
Initialization Vector (IV)
Required for most block ciphers (length depends on method)
PHP Code
This is the actual PHP code that will be executed
Loading editor...
Common Examples
openssl_encrypt() Function Guide
Key Features
This tool is a free online PHP compiler that runs directly in your browser. It allows you to execute openssl_encrypt() functions instantly without setting up a local environment, making it perfect for quick testing and learning.
- Supports multiple cipher methods (AES, DES, etc.)
- Returns Base64 encoded string by default
- Requires IV for most secure block ciphers
Security Tips
- Always use a random IV for each encryption
- Use a strong, random key
- Consider using
openssl_random_pseudo_bytes()for IV generation - Authenticated encryption (like GCM) is recommended over CBC
Request a Feature
Have an idea to improve this tool? Share your suggestions and help us make it better! (One request per day)

