RSA cipher
Encrypt and decrypt numbers with RSA, including generating a key pair from two primes.
RSA cipher
This tool runs RSA, the public-key algorithm behind HTTPS and PGP, entirely in your browser. Pick a key size and it builds a key pair from two primes chosen behind the scenes, or type in your own values for p and q to see exactly how the math works. Paste text, hex or Base64 into the box, choose encrypt or decrypt, and the result updates as you type.
Under the hood, every byte of the input is raised to the public exponent e modulo n to encrypt it, and to the private exponent d modulo n to decrypt it — the same operation the classic p=61, q=53 textbook example uses, just automated. The key size preset picks two primes for you; the "Prime p" and "Prime q" fields let you override that, and the tool checks that your values are genuinely prime, distinct and large enough first. Plaintext format controls how the input (or decrypted output) is read — as text, hex or Base64 — while ciphertext format controls how the encrypted result is written, in hex or Base64. There is no salt or iteration count here, because RSA doesn't use either — it's a direct operation on numbers derived from the primes, not a password-based scheme.
Switch the mode to swap encrypt for decrypt and the tool tries to reverse the last result with the same key. Because these keys are small enough to compute instantly in a browser tab, they're for learning how RSA works, not for protecting anything real — use the site's encrypt-text tool (AES-256-GCM) for that. The "compare to expected value" field checks your result against a known answer, handy when following a textbook example.
Everything runs locally: no keys, primes or text are ever sent anywhere. Copy the result, download it as a .txt file, or send the output straight back into the input to chain another step.