Skip to main content
Utilavo

RC4 Encrypt / Decrypt

Encrypt and decrypt data with the RC4 stream cipher with configurable key size and drop bytes

How to use RC4 Encrypt / Decrypt

  1. Enter your data and key

    Type or paste the text to encrypt or decrypt and enter your RC4 key.

  2. Set drop bytes

    Configure the number of initial keystream bytes to discard (default: 768). Discarding 768 or more bytes significantly mitigates known biases.

  3. Click Encrypt or Decrypt

    The output appears instantly. RC4 encryption and decryption are the same operation — apply the cipher twice to recover the original.

  4. Copy the output

    Click Copy to use the result.

Operation

RC4 has known statistical biases and is prohibited in TLS. Do not use for new applications.
Cipher Settings
Key Configuration

Key Type

What is RC4 encryption?

RC4 keeps no blocks and needs no padding. It maintains a 256-byte permutation state, emits one pseudorandom byte at a time, and XORs that keystream against the plaintext — which is why encryption and decryption are the same operation, and why the whole algorithm fits in about twenty lines of code.

That compactness made it the most deployed stream cipher in history: the default in SSL and TLS for over a decade, the cipher underneath WEP, and the encryption inside Microsoft Office, WinZip, and assorted database products. Ron Rivest designed it in 1987 for RSA Data Security, and the algorithm stayed a trade secret until someone posted it anonymously to the Cypherpunks mailing list in 1994.

The keystream is where it fails. Fluhrer, Mantin and Shamir showed in 2001 that when a key is used with varying public prefixes, the first output bytes correlate with the key itself. WEP did exactly that, prepending a 24-bit initialization vector to a fixed shared key for every packet; with only 16 million possible IVs, repeats arrive quickly on a busy network, and the FMS attack recovers the key from passively captured traffic in minutes. WPA with TKIP, and later AES-CCMP, exist because of this.

The early bytes are not the only problem. AlFardan, Bernstein and colleagues demonstrated in 2013 that statistical biases run through the entire keystream, allowing plaintext recovery from TLS given enough captured sessions, and RFC 7465 prohibited RC4 in TLS outright in 2015. The drop parameter this tool exposes discards the first N keystream bytes — 768 is the usual figure — which removes the FMS-class weakness but leaves the deeper biases untouched. Use AES-256 for anything real, and see our encryption algorithms guide for how the cipher families compare.

Frequently asked questions

Why was RC4 banned from HTTPS?

RC4 has statistical biases in its keystream output that allow attackers to recover plaintext from encrypted data given enough ciphertext. In 2015, RFC 7465 prohibited the use of RC4 in TLS. It should not be used for securing sensitive data.

What does the 'drop' parameter do?

The initial bytes of the RC4 keystream have known statistical weaknesses. The drop parameter discards the first N bytes of keystream before encryption begins. Discarding 768 or more bytes (RC4-drop[768]) substantially reduces but does not eliminate the weakness.

Why is RC4 encryption and decryption the same operation?

RC4 is a stream cipher — it XORs plaintext with a keystream. XOR is its own inverse: applying the same keystream again recovers the original text. This symmetry simplifies implementation.

When would I use RC4?

Only for decrypting data encrypted by legacy systems that use RC4 (WEP WiFi, older WinZip, some database encryption). No new application should encrypt with RC4.

How was WEP WiFi encryption broken using RC4?

WEP concatenated a 24-bit initialization vector (IV) with the WEP key and used the result as the RC4 key for each packet. The short IV space (only 16 million values) meant IVs were frequently reused, and the Fluhrer-Mantin-Shamir attack exploited correlations between the IV and the first keystream bytes to recover the key. This could be done passively by capturing enough packets, typically within minutes on a busy network. WEP was replaced by WPA (using TKIP, then AES-CCMP) as a result.

Is RC4-drop[768] secure enough for non-critical use?

RC4-drop[768] discards the first 768 bytes of keystream, which eliminates the strongest statistical biases in the early output. However, weaker biases persist throughout the entire keystream, and the algorithm lacks the structural security guarantees of modern ciphers. For non-critical applications where compatibility with RC4 systems is required, RC4-drop[768] is a reasonable mitigation. For any data that needs genuine confidentiality, use AES instead.

Related tools

Related guides