ROT13 ("rotate by 13 places") is one of the simplest and most well-known letter substitution ciphers. It replaces each letter with the letter 13 positions after it in the alphabet.
How ROT13 Works
The English alphabet has 26 letters. Shifting by 13 means applying ROT13 twice returns the original text — the same function both encodes and decodes.
ROT13 Substitution Table
| Original | A | B | C | D | E | F | G | H | I | J | K | L | M |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ROT13 | N | O | P | Q | R | S | T | U | V | W | X | Y | Z |
| Original | N | O | P | Q | R | S | T | U | V | W | X | Y | Z |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ROT13 | A | B | C | D | E | F | G | H | I | J | K | L | M |
Key Properties
| Property | Description |
|---|---|
| Symmetric | Encoding = Decoding (apply twice = original) |
| Alphabet only | Numbers and special characters are unchanged |
| Case preserving | Uppercase stays uppercase, lowercase stays lowercase |
| Not encryption | Provides no real security — it is trivially reversible |
History and Use Cases
ROT13 originated in Usenet newsgroups in the 1980s. Common uses include:
ROT13 in Programming
function rot13(str) {
return str.replace(/[A-Za-z]/g, c =>
String.fromCharCode(
c.charCodeAt(0) + (c.toLowerCase() < 'n' ? 13 : -13)
)
);
}
ROT13 vs Other Ciphers
ROT13 is part of the broader Caesar cipher family (shift ciphers). While ROT13 shifts by 13, a Caesar cipher can shift by any amount. None provide real security and should never be used for sensitive data.
Try It Yourself
Encode or decode ROT13 text instantly with our free ROT13 Encoder.