Choose how many positions to shift the alphabet (0 to 25).
See how letters align with a shift of {{ shiftKey }} positions. Hover over any letter mapping.
Trace the character shift addition/subtraction step-by-step.
Learn the modular arithmetic and algebraic equations behind this historical shift cipher.
Each plaintext character index Pi (0 for A, 25 for Z) is shifted forward by the key K. The mod 26 operation wraps any overflow back to the beginning of the alphabet.
Each ciphertext character index Ci is shifted backward by K. In modular arithmetic, if subtracting K results in a negative number, we add 26 to ensure the result falls within [0, 25].
ROT13 uses a shift key of K = 13. Because 13 is exactly half of the 26-letter alphabet, encryption and decryption are reciprocal operations:
This means applying ROT13 twice to any input returns the original plaintext.
Named after Julius Caesar, who used it with a shift of 3 to communicate state messages secretly. While insecure today due to only having 25 possible keys (which are easily brute-forced), it serves as the foundational building block for many modern block ciphers.