ROT13 Cipher
ROT13 — the 13-letter Cæsar cipher. Each letter is replaced by the one 13 positions later in the alphabet. Encoding and decoding are the same operation.
Hello World → Uryyb Jbeyq
ROT13 — the 13-letter Cæsar cipher. Each letter is replaced by the one 13 positions later in the alphabet. Encoding and decoding are the same operation.
Hello World → Uryyb Jbeyq
ROT13 ("rotate by 13") is a Cæsar cipher that shifts every letter by 13 positions in the alphabet. Because the English alphabet has 26 letters, applying ROT13 twice returns the original text — encoding and decoding are the same operation.
It's not real cryptography (anyone can decode it instantly), but it's been the standard way to hide spoilers, punchlines, and answers on Usenet, forums, and chat platforms since the 1980s.
ROT13 is a special case of the Caesar cipher with a shift of 13. The algorithm iterates over each character in the input string. If the character is an uppercase ASCII letter (A–Z, Unicode code points 65–90), it is mapped to the character 13 positions later, wrapping around: new_code = ((old_code - 65 + 13) % 26) + 65. Similarly, lowercase letters (a–z, code points 97–122) use new_code = ((old_code - 97 + 13) % 26) + 97. All other characters—digits, punctuation, spaces, non-ASCII letters—remain unchanged. Because the alphabet has 26 letters, applying ROT13 twice yields the original text; thus enciphering and deciphering are identical operations. The implementation handles UTF-8 input, but the transformation only affects the Latin alphabet range.
ROT13 is trivially reversible, but different approaches exist to achieve the same result.
| This tool | Python one-liner | tr command | |
|---|---|---|---|
| Ease of use | No setup, instant result | Requires Python installed and command line | Requires Unix shell and tr utility |
| Case preservation | Preserved automatically | Handled with separate mappings | Preserved when using appropriate character classes |
| Non-English support | Only ASCII Latin letters | Can be extended to other alphabets | Limited to ASCII; needs extra scripting |
ROT13 emerged in the early 1980s on Usenet, a decentralized bulletin-board system. It was used to obscure potentially offensive jokes, spoilers, or answers to puzzles, allowing readers to choose whether to decrypt. The number 13 was chosen because it is exactly half of 26, making encryption and decryption identical—a convenience for users. While not a secure cipher, ROT13 became a cultural artifact of early online communities, predating modern content-warning systems.
Posting a movie or TV plot point? ROT13-encode it. Readers who want the spoiler can decode; everyone else sees gibberish and skips.
Set up a joke in plain text, ROT13 the punchline. Readers who want it decode; the rest move on.
Quiz answers, puzzle solutions, riddle reveals — ROT13 lets you publish the answer below the question without it being visible to skimmers.
The simplest possible example of a substitution cipher. Demonstrates the principle without overwhelming the learner.
ROT13'd content in a comment is unsearchable as plain text — useful as a notes-to-self area or to bypass crude content filters.
No, not for any real privacy purpose — anyone can decode it in seconds. Use it only for casually hiding content from accidental viewing.
No — only A–Z and a–z are shifted. Numbers, spaces, punctuation, and other characters pass through unchanged.
13 + 13 = 26, and 26 mod 26 = 0 — back to the start. ROT13 is its own inverse, which is why both encode and decode use the same operation.
ROT13 is one of 25 possible Cæsar ciphers (shifts of 1 through 25). ROT13 is uniquely useful because of the symmetric encode/decode property.