ROT13 vs ROT47 vs Caesar
| Cipher | Hello, World! 2026 becomes | What it changes |
|---|---|---|
| ROT13 | Uryyb, Jbeyq! 2026 |
Letters only; applying it twice gives back the original |
| ROT47 | w6==@[ (@C=5P a_ae |
All printable ASCII from ! to ~, including digits and punctuation |
| Caesar, shift 3 | Khoor, Zruog! 2026 |
The cipher Julius Caesar is said to have used |
ROT13 in code
import codecs
codecs.encode("Hello, World!", "rot13") # 'Uryyb, Jbeyq!'
echo 'Hello, World!' | tr 'A-Za-z' 'N-ZA-Mn-za-m' # Uryyb, Jbeyq!
const rot13 = (s) =>
s.replace(/[a-z]/gi, (c) => {
const base = c <= 'Z' ? 65 : 97;
return String.fromCharCode(((c.charCodeAt(0) - base + 13) % 26) + base);
});
Want to hide text in another way? Try Morse code, reverse text or Base64, none of which are encryption either.
Frequently asked questions
What is ROT13?
A substitution cipher that replaces each letter with the one 13 places later in the alphabet, wrapping around: A becomes N, N becomes A. Because the English alphabet has 26 letters, shifting by 13 twice gets you back where you started, so the same operation encodes and decodes. Digits, punctuation and non-Latin letters are left alone.
Is ROT13 secure?
No, not at all. It has no key, so anyone can reverse it instantly. It’s used to hide text from a casual glance, like spoilers, puzzle answers and punchlines in forums and Usenet, not to protect anything. For real secrecy use proper encryption such as AES, and for passwords use a password hash like bcrypt.
What’s the difference between ROT13, ROT47 and a Caesar cipher?
ROT13 is a Caesar cipher with a shift of 13. A Caesar cipher can use any shift from 1 to 25, and decoding needs the opposite shift. ROT47 rotates all 94 printable ASCII characters by 47 instead of just the letters, so numbers and symbols are hidden as well; like ROT13, it is its own inverse.
How do I crack a Caesar cipher?
Try all 25 shifts; only one gives readable text. Choose Caesar shift and step through the shift number until the output makes sense. For longer texts, the most common letter in the ciphertext usually stands for E.