The ROT-N cipher is the general form of the Caesar cipher: it shifts every letter a chosen number of places along the alphabet. By letting you pick the rotation N from 1 to 25, it covers the whole family of simple shift ciphers, including the historic Caesar cipher (N=3) and the self-inverse ROT13 (N=13). It is a favourite for puzzles, escape rooms and introductory cryptography lessons.
How it works
Each letter has a position in the alphabet from 0 (A) to 25 (Z). Encoding adds N to that position and wraps with modulo 26, so a letter at position p becomes (p + N) mod 26. Uppercase and lowercase are handled separately and case is preserved. Decoding subtracts N, which is mathematically identical to encoding with 26 - N — that is exactly what this tool does in decode mode, so the same N always reverses cleanly.
Only the 26 Latin letters are affected. Digits, whitespace and punctuation are copied straight through, keeping the shape of the message readable while the letters are scrambled.
Example
With N=3 (the Caesar cipher), encoding shifts each letter three places forward:
GERA -> JHUD
G (6) becomes J (9), E (4) becomes H (7), and so on. Decoding JHUD with N=3 shifts back three places and returns GERA. With N=13 the cipher equals ROT13, where GERA becomes TREN.
The full shift table for N=3 (Caesar cipher)
| Plain | A B C D E F G H I J K L M |
|---|---|
| Cipher | D E F G H I J K L M N O P |
| Plain | N O P Q R S T U V W X Y Z |
|---|---|
| Cipher | Q R S T U V W X Y Z A B C |
Every other value of N produces an equivalent table shifted by a different offset.
When to use which N
| N | Name | Special property |
|---|---|---|
| 3 | Caesar cipher | Historical; attributed to Julius Caesar |
| 13 | ROT13 | Self-inverse: encode and decode are the same operation |
| Any 1–25 | Generic ROT-N | The encode and decode shifts are different (N and 26−N) |
ROT13’s self-inverse property makes it uniquely convenient for hiding and revealing text in a single step — the same tool and same N both scrambles and unscrambles. For every other N, you need to track which direction you used.
Breaking a ROT-N cipher
A ROT-N encoded message is straightforward to crack by hand. English letter frequency gives E as the most common letter, appearing roughly 13% of the time in typical text, followed by T, A, O, I, N. In an encoded message, the most frequent letter is most likely E or one of the other common letters. The shift between that letter and its cipher equivalent gives you N. With the correct N, full decryption takes seconds.
This makes ROT-N completely unsuitable for real security. It is appropriate only for puzzles, obfuscation games and educational demonstrations of why shift ciphers fail.
Notes
- Because there are only 25 useful shifts, a ROT-N message can be cracked by brute force or by spotting the most common letter — it offers no real security.
- N=13 is the only shift that is its own inverse; for all other N the encode and decode directions differ.
- To rotate digits and symbols as well as letters, use the ROT47 tool.