ROT13 Encoder & Decoder

Self-inverse letter rotation by 13 — the classic spoiler tool

Ad placeholder (leaderboard)

ROT13 (“rotate by 13 places”) is a simple letter-substitution cipher that shifts each letter halfway around the alphabet. It became famous on Usenet newsgroups as a polite way to hide spoilers, punch lines and puzzle answers — readers had to deliberately decode the text to see it. It is still widely used in puzzle hunts and as a teaching example.

How it works

For each letter, ROT13 adds 13 to its position in the alphabet and wraps around if it passes Z. In formula terms, an uppercase letter at position p (where A is 0) maps to position (p + 13) mod 26. So A (0) becomes N (13), and N (13) becomes A again because (13 + 13) mod 26 = 0. Lowercase letters follow the same rule independently, and case is preserved. Any character that is not an ASCII letter — a digit, space or symbol — is copied through unchanged.

The defining property is that ROT13 is its own inverse. Applying it twice rotates a total of 26 places, a full loop, returning the original letter. That is why a single tool both scrambles and unscrambles, with no separate “decode” mode needed.

Example

Encoding the word Gera:

  • G → T
  • e → r
  • r → e
  • a → n

So Gera becomes Tren, and running Tren through ROT13 again gives back Gera. The full lower-case mapping is abcdefghijklmnopqrstuvwxyz to nopqrstuvwxyzabcdefghijklm.

Notes

  • ROT13 only touches the 26 Latin letters. Use ROT47 to also rotate digits and punctuation, or ROT-N to choose a different shift.
  • It is unkeyed, so treat it as obfuscation, not encryption.
Ad placeholder (rectangle)