ROT-13 (“rotate by 13 places”) is a simple letter-substitution cipher that shifts each letter 13 positions forward in the alphabet. It is most often used to hide spoilers, puzzle solutions, or punchlines so they are not readable at a glance — never for genuine security.
How it works
Each letter is mapped to the letter 13 positions later, wrapping around the end of the alphabet:
A→N B→O C→P … M→Z N→A … Z→M
Formally, for a letter with zero-based position p in its case, the output position is (p + 13) mod 26. Because 13 + 13 = 26, applying the shift twice returns the original letter — so ROT-13 is its own inverse and one operation both encodes and decodes. Non-letters (digits, spaces, punctuation, emoji) are passed through completely unchanged.
A worked example
The word Hello transforms character by character:
| Original | Position | +13 | Result |
|---|---|---|---|
| H | 7 | 20 | U |
| e | 4 | 17 | r |
| l | 11 | 24 | y |
| l | 11 | 24 | y |
| o | 14 | 1 | b |
So Hello becomes Uryyb. Pasting Uryyb back in returns Hello. Case is always preserved — a lowercase input letter always produces a lowercase output letter.
When ROT-13 is actually used
ROT-13 has a specific cultural niche in online communities and developer culture:
- Spoiler hiding — Usenet and early web forums used ROT-13 so a reader could consciously choose to decode a film or book spoiler rather than stumble into it.
- Puzzle answers — crossword and riddle sites sometimes print the answer in ROT-13 below the puzzle so it is not visible at a glance but is immediately available.
- Developer easter eggs — some programs encode irreverent messages in ROT-13 so they do not appear in plain-text searches of the source.
- Learning about ciphers — ROT-13 is the standard first example when teaching substitution ciphers because its self-inverse property is elegant and easy to verify by hand.
What ROT-13 is NOT
ROT-13 provides zero cryptographic security. It can be read by anyone who recognises the pattern, and it appears in many basic programming exercises precisely because reversing it is trivial. If you need to protect sensitive content, use a proper authenticated encryption scheme — ROT-13 is obfuscation only.