RSA Encryption

Generate RSA-2048 key pairs and encrypt/decrypt messages using Web Crypto API. Client-side only.

RSA Encrypt Decrypt

RSA uses two keys: a public key anyone can use to encrypt a message, and a private keyonly you can use to decrypt it. To receive encrypted messages, generate a key pair below and share your public key — keep the private key secret. To send someone else a message only they can read, paste their public key into the Encrypt section instead of generating your own; you don't need a key pair of your own just to send.

Key generation

No key pair generated

Encrypt

Generate a key pair above to decrypt messages sent to you - or just paste someone else's public key into Encrypt to send them one

This is RSA-OAEP with SHA-256 on a 2048-bit modulus, running entirely on the browser's Web Crypto API — keys are generated locally and never leave the page. The asymmetric split means you can encrypt to someone using only their public key; no shared secret has to exist beforehand.

The 190-byte ceiling, and what to do about it

RSA-2048 with OAEP-SHA-256 can encrypt at most 190 bytes in one operation: the 256-byte modulus minus two 32-byte hash values minus 2 bytes of OAEP framing. That limit is in bytes of UTF-8, not characters — 48 emoji is 192 bytes and already fails. This is not a flaw in the tool; it is why no real protocol encrypts bulk data with RSA directly. TLS, PGP, and everything in between generate a random symmetric key, encrypt the payload with AES, and use RSA only to wrap the small key. If your message will not fit, that hybrid pattern is the answer, not a bigger RSA key.

Key format matters when pasting keys from elsewhere. The tool needs an SPKI/PKCS#8-style public key — the kind that starts with -----BEGIN PUBLIC KEY-----. It explicitly rejects PKCS#1 keys (-----BEGIN RSA PUBLIC KEY-----, common from older OpenSSL and from ssh-keygen -e -m PEM exports), certificates, and private keys, each with a distinct error message telling you what you pasted instead. To convert a PKCS#1 key: openssl rsa -pubin -RSAPublicKey_in -in old.pem -pubout.

Step by step

  1. Generate a key pair, or skip generation entirely and paste the recipient's public key into the Encrypt section — you only need your own pair to receive messages, not to send them.
  2. Encrypt with the public key of whoever should be able to read the message. The Base64 ciphertext is always 344 characters, regardless of how short the message is.
  3. Decrypt with the private key from the pair generated in this session. Keys are held in memory only and are gone when you leave the page — and the tool has no private-key import, so if you need to decrypt later, save the PKCS#8 private key PEM and use it with OpenSSL or your own code.

Questions people ask

One message, a different 344-character ciphertext on every run — which one is correct?

Both. OAEP mixes fresh random bytes into every encryption, so the same message under the same key produces a different 344-character ciphertext each time — and each one decrypts to the same plaintext. This randomization is a security requirement: without it, an attacker could confirm guesses by encrypting candidates with your public key and comparing.

Why does decryption show [Decryption failed] on ciphertext I know is valid?

The Decrypt section only uses the private key generated in the current session. Ciphertext encrypted with any other public key — including a pair you generated here yesterday — cannot be decrypted by today's key. OAEP also binds the ciphertext to the exact padding parameters, so ciphertext produced elsewhere with OAEP-SHA-1 (a common library default) will fail against this tool's OAEP-SHA-256 even with the right key.

In practice RSA carries the key and AES carries the data — the AES tool here covers that half. The JWT decoder is the other place RSA shows up on this site, as the RS256 signatures on tokens.