ROT13 and ROT Ciphers Explained with Examples
2026-06-09 · 4 min read
Figure 1: ROT13 and ROT Ciphers
What is a ROT Cipher?
A ROT cipher is a substitution cipher that shifts each letter of the alphabet by a fixed number of positions.
ROT stands for rotate. The number after ROT tells you how many positions each letter is shifted.
For example, ROT3 shifts every letter three places forward. A becomes D. B becomes E. Z wraps around to C.
ROT ciphers are one of the oldest and simplest forms of text encoding. They are often used in puzzles, CTF challenges, and basic obfuscation tasks.
What is ROT13?
ROT13 is the most well-known ROT cipher. It shifts every letter by exactly 13 positions.
Because the English alphabet has 26 letters, applying ROT13 twice returns the original text. This means the same operation encodes and decodes.
ROT13 example:
| Original | Encoded |
|---|---|
| A | N |
| B | O |
| M | Z |
| N | A |
| Z | M |
Full example:
Input:
Hello World
ROT13 output:
Uryyb Jbeyq
Apply ROT13 again:
Hello World
This self-reversing property makes ROT13 useful for hiding text without needing a key.
Where ROT13 is Used
- Hiding spoilers in forums and online communities
- Obfuscating text in CTF challenges
- Basic text puzzles and word games
- Simple encoding in early internet communities like Usenet
What is ROT47?
ROT47 extends the rotation idea to a wider character set. Instead of rotating only letters, ROT47 rotates 94 printable ASCII characters from ! (code 33) to ~ (code 126).
This means ROT47 can encode symbols, numbers, and punctuation in addition to letters.
ROT47 example:
Input:
Hello World! 123
ROT47 output:
w6==@ (@C=5P `ab
Like ROT13, ROT47 is also self-reversing. Applying it twice returns the original text.
ROT13 vs ROT47: Key Differences
| Feature | ROT13 | ROT47 |
|---|---|---|
| Shifts | Letters only | Printable ASCII characters |
| Character range | A to Z (26 letters) | ! to ~ (94 characters) |
| Numbers encoded | No | Yes |
| Symbols encoded | No | Yes |
| Self-reversing | Yes | Yes |
| CTF usage | Common | Common |
Other ROT Variants
Any number from 1 to 25 can be used as a shift value.
Common variants:
| Name | Shift | Notes |
|---|---|---|
| ROT1 | 1 | Minimal shift |
| ROT5 | 5 | Sometimes used for numbers only |
| ROT13 | 13 | Most common, self-reversing |
| ROT18 | 18 | ROT13 for letters plus ROT5 for digits |
| ROT25 | 25 | Same as shifting back by 1 |
ROT5 is sometimes applied only to digits (0 to 9), rotating them within that range. ROT18 combines ROT13 for letters and ROT5 for digits in a single pass.
How to Decode a ROT Cipher
To decode a ROT cipher, shift each letter back by the same number of positions.
For ROT13, the decode step is the same as the encode step because 13 plus 13 equals 26.
For any other ROT value, the decode shift is 26 minus the encode shift.
Example:
ROT7 encodes A as H. To decode H back to A, shift back by 7, which is the same as shifting forward by 19 (26 minus 7).
ROT Ciphers in CTF Challenges
ROT ciphers are frequently used in beginner and intermediate CTF challenges.
Common scenarios:
- A message is encoded with ROT13 and hidden in a file or webpage.
- A flag is ROT47-encoded inside a binary or log file.
- Text is encoded with an unknown ROT shift, requiring you to test all 25 possibilities.
- Multiple layers of ROT are applied, requiring repeated decoding.
When you encounter an encoded string in a CTF and it looks like readable text but with shifted letters, trying ROT13 first is a good starting point.
If ROT13 does not produce readable output, try all 25 possible shift values. This brute-force approach works because there are only 25 options.
How to Recognize a ROT-Encoded String
ROT-encoded text has these characteristics:
- Only letters are shifted (for ROT13). Spaces, numbers, and punctuation stay the same.
- The text keeps the same word lengths and spacing as the original.
- The character frequency distribution looks similar to natural language.
If a suspicious string has normal word lengths and spacing but unrecognizable words, ROT13 or another ROT variant is a likely candidate.
Decode ROT Ciphers Online
You can decode ROT13, ROT47, and other ROT variants instantly at KeyDecryptor ROT Decoder.
Steps:
- Paste your encoded text.
- Select the ROT variant or shift value.
- Click Decode to get the result.
No installation is required. The tool works in your browser.
Frequently Asked Questions
Is ROT13 encryption?
No. ROT13 is encoding, not encryption. It has no key and provides no real security. Anyone can reverse it without any secret information.
Can ROT ciphers be used for security?
ROT ciphers are not suitable for protecting sensitive data. They are used for puzzles, obfuscation, and hiding casual text from casual readers, not for real security.
What is the difference between ROT13 and Caesar cipher?
The Caesar cipher shifts letters by any fixed amount. ROT13 is a specific Caesar cipher with a shift of 13. ROT13 has the extra property of being self-reversing because 13 is half of 26.
How do I crack an unknown ROT cipher?
Try all 25 possible shift values from ROT1 to ROT25. Read each output and check if it looks like readable text. With only 25 options, this takes seconds.
Does ROT13 change numbers or punctuation?
Standard ROT13 only rotates letters. Numbers, spaces, and punctuation are not changed. ROT47 does affect numbers and symbols.