DevKits

RSA Encrypt & Decrypt Online — RSA-OAEP with PEM or JWK Keys

Encrypt text with an RSA public key or decrypt ciphertext with the private key, using RSA-OAEP (SHA-256/384/512). Accepts PEM (PKCS#8 / SPKI) or JWK. 100% local — keys and plaintext never leave your browser tab.

Last updated:

Comments

Encryption and decryption run entirely in your browser via the Web Crypto API. Your private key and plaintext never leave the tab. Need a fresh key pair? Try our RSA Key Generator.

Frequently Asked Questions

Why is RSA-OAEP recommended over PKCS#1 v1.5 encryption?

RSA-OAEP (RFC 8017) uses a padding scheme with a security proof under standard assumptions, and it's much harder to attack than the older PKCS#1 v1.5 encryption padding, which is vulnerable to Bleichenbacher-style attacks against many real implementations. All modern libraries default to OAEP for encryption. Only fall back to PKCS#1 v1.5 when interoperating with strictly legacy systems — and in that case, don't use this tool, use a library where you can audit constant-time behavior.

What's the maximum plaintext I can encrypt?

For RSA-OAEP with a k-byte modulus and an h-byte hash: k − 2·h − 2 bytes. So RSA-2048 (256 B) with OAEP-SHA-256 (32 B) fits at most 190 bytes. RSA is not meant for bulk encryption — the standard pattern is 'hybrid encryption': generate a random AES key, encrypt your data with AES-GCM, then encrypt just the 32-byte AES key with RSA-OAEP.

Do the hash algorithm and the two sides have to match?

Yes. RSA-OAEP internally uses a hash function; encryption and decryption MUST use the same hash (and the same MGF1 hash, which WebCrypto ties to the main hash). If your ciphertext was produced with SHA-1 and you try to decrypt with SHA-256, decryption fails with a padding error. When someone else produced the ciphertext, ask them which hash they used.

Which key formats are supported?

Both PEM and JWK. For PEM, the private key must be PKCS#8 (-----BEGIN PRIVATE KEY-----) and the public key must be SPKI (-----BEGIN PUBLIC KEY-----). For JWK, paste the JSON object as-is (with kty="RSA"). If your key is in a legacy format, convert with: openssl pkcs8 -topk8 -nocrypt -in old.pem -out new.pem.

Is my private key uploaded anywhere?

No. All operations run in your browser via crypto.subtle. You can verify with DevTools Network panel — clicking Decrypt produces zero network traffic. That said, don't paste production private keys into unfamiliar tools; use this for development, testing, and one-off decryptions.

Related Tools

JWT Decoder

Decode JSON Web Tokens (JWT) to inspect the header, payload, and signature. Runs entirely in your browser — tokens are never sent to any server.

AES Encrypt / Decrypt

Encrypt and decrypt text with AES (128 / 192 / 256, GCM authenticated or CBC legacy) using a password. PBKDF2 key derivation with 200,000 iterations. 100% local — the Web Crypto API runs entirely in your browser.

RSA Key Generator

Generate RSA key pairs (2048, 3072, or 4096 bits) online for OAEP encryption, PSS signing, or RS256 JWTs. Exports PKCS#8 private key + SPKI public key as PEM, JWK, or DER (hex/base64). 100% local — the Web Crypto API runs in your browser, private keys never leave the tab.

Public Key Extractor

Paste an RSA or EC private key (PEM PKCS#8 or JWK) and instantly extract the matching public key in PEM (SPKI), JWK, or DER format. Perfect for publishing a JWKS endpoint, verifying a token against a private-key-only backup, or distributing a public key to peers. 100% local — the private key never leaves your browser.

ECDSA Sign / Verify

Sign or verify messages with ECDSA (P-256, P-384, P-521) using PEM or JWK keys. Outputs both JOSE / P1363 (JWT-compatible) and DER (OpenSSL-compatible) signatures. 100% local via the Web Crypto API.

ECDSA Key Generator

Generate elliptic-curve key pairs (P-256, P-384, P-521) for ECDSA signatures or ECDH key agreement. Exports PKCS#8 / SPKI PEM, JWK, and DER (hex/base64). Perfect for ES256/ES384/ES512 JWTs. 100% local via the Web Crypto API — the private key never leaves your browser.