Loading search...

RSA Encrypt Online

Need a key? Generate RSA Key Pair
Copy

Encrypt a message with an RSA public key directly in your browser. Paste any PEM-format public key, type your message, and get the RSA-OAEP ciphertext in base64 or hex format. All processing is client-side — your keys and messages never leave your device.

How RSA Encryption Works

RSA encryption is asymmetric: the public key encrypts, and only the corresponding private key can decrypt. This allows anyone to send encrypted data to a recipient without ever sharing a secret — the recipient's public key is freely distributed.

This tool uses RSA-OAEP (Optimal Asymmetric Encryption Padding), the modern standard recommended by NIST. OAEP is randomized — each encryption of the same message produces different ciphertext, preventing pattern analysis.

RSA Message Size Limits

  • 2048-bit key + SHA-256: max ~190 bytes plaintext
  • 4096-bit key + SHA-256: max ~446 bytes plaintext
  • For larger data, use hybrid encryption: encrypt data with AES, encrypt the AES key with RSA

Use Cases

  • Securely sending passwords or API keys to a recipient
  • Encrypting small secrets for storage
  • Testing RSA key pairs before deployment
  • Educational demonstrations of public-key cryptography

Frequently Asked Questions

What padding scheme does this tool use?

This tool uses RSA-OAEP (Optimal Asymmetric Encryption Padding), which is the recommended modern standard. RSA-OAEP is probabilistic (produces different ciphertext each time for the same input) and is provably secure under the random oracle model. The older PKCS#1 v1.5 padding is vulnerable to Bleichenbacher's attack and should be avoided for new systems.

How much data can RSA encrypt?

RSA can only encrypt data up to the key size minus padding overhead. For a 2048-bit (256-byte) key with RSA-OAEP-SHA-256, the maximum message size is 190 bytes. For larger data, use hybrid encryption: generate a random AES key, encrypt the data with AES, then encrypt the AES key with RSA.

Why does the same message produce different ciphertext each time?

RSA-OAEP uses a random seed in its padding scheme, making it probabilistic. This is a security feature — identical plaintexts produce different ciphertexts, preventing an attacker from confirming whether two ciphertexts are encryptions of the same message.

Which hash algorithm should I match?

The hash algorithm used for encryption must match the one used for decryption. SHA-256 is the standard choice. Ensure the receiving party uses the same hash when importing their private key for decryption.

Can I use the encrypted output directly with OpenSSL or Node.js?

Yes. The base64 output is the raw RSA-OAEP ciphertext and can be used with any library that supports RSA-OAEP (OpenSSL, Node.js crypto, Python cryptography, Java, etc.) as long as the same key and hash algorithm are used.