ROT13 Encoder / Decoder
Encode and decode text with the ROT13 letter substitution cipher
0 characters
Type or paste text above to see the ROT13-transformed result. ROT13 is its own inverse — apply it twice to get the original text back.
You’re reading through a forum thread and someone posted a spoiler wrapped in ROT13. Or you’re looking at an old Usenet archive where punchlines and puzzle answers were routinely obfuscated with ROT13(). You need to decode it — quickly, without installing anything.
What Is ROT13?
ROT13 (“rotate by 13 places”) is a specific instance of the Caesar cipher that shifts each letter of the Latin alphabet by 13 positions. Because the alphabet has 26 letters, applying ROT13 twice returns the original text — making the same operation both the encoder and decoder.
Plain: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Cipher: N O P Q R S T U V W X Y Z A B C D E F G H I J K L M
The mapping is case-preserving: uppercase letters stay uppercase, lowercase stay lowercase. Non-alphabetic characters — digits, punctuation, spaces, Unicode — pass through unchanged.
Input: Hello, World! 123
Output: Uryyb, Jbeyq! 123
History and Origin
ROT13 became popular on Usenet newsgroups in the early 1980s as a lightweight way to hide spoilers, offensive jokes, and puzzle answers. The rot13 command was included in early BSD Unix distributions (4.2BSD, 1983), and the tr command made it trivial:
echo "Hello" | tr 'A-Za-z' 'N-ZA-Mn-za-m'
# Uryyb
Unlike real encryption, ROT13 was never intended to provide security. Its purpose is social: to prevent accidental reading of text that the viewer must deliberately choose to decode. The Usenet convention was explicit — if you saw ROT13: in a post, you knew you were opting in to read the content.
ROT13 vs Other Caesar Cipher Shifts
The Caesar cipher is a family of substitution ciphers parametrized by a shift value (1–25). ROT13 is special because shift-13 is its own inverse — no separate decode operation is needed. Any other shift value (e.g., ROT1, ROT5, ROT7) requires a different shift to reverse.
| Shift | Encode “ABC” | Self-inverse? |
|---|---|---|
| ROT1 | BCD | No (needs ROT25) |
| ROT5 | FGH | No (needs ROT21) |
| ROT13 | NOP | Yes |
This self-inverse property is the reason ROT13 became the convention rather than any other shift — it simplifies tooling, reduces mistakes, and means a single button does both operations.
ROT13 in Modern Software
Despite its simplicity, ROT13 still appears in modern codebases:
- Email obfuscation: Some anti-scraping systems ROT13-encode email addresses in HTML source, decoding them with JavaScript at render time. This stops naive bots while keeping addresses accessible to users.
- CTF challenges: Capture-the-flag competitions use ROT13 as a warm-up cipher or as one layer in multi-step encoding chains.
- Code obfuscation: Developers occasionally ROT13-encode strings (API endpoints, error messages) to prevent them from appearing in plaintext searches of source code. This is security by obscurity — not actual protection — but it can reduce accidental exposure.
- Test data: ROT13 is a convenient way to generate visually distinct but reversible test strings.
When NOT to Use ROT13
ROT13 provides zero cryptographic security. It is trivially broken by anyone who recognizes the pattern (or tries all 25 Caesar shifts in under a second). Never use ROT13 for:
- Passwords or credentials
- API keys or tokens
- Personal data or PII
- Any data that needs actual confidentiality
For real encryption, use AES-GCM, ChaCha20-Poly1305, or another authenticated encryption algorithm. ROT13 is for social obfuscation only.
Implementation Details
The JavaScript implementation in this tool maps each character through a lookup:
function rot13(str) {
return str.replace(/[A-Za-z]/g, c => {
const base = c <= 'Z' ? 65 : 97;
return String.fromCharCode(((c.charCodeAt(0) - base + 13) % 26) + base);
});
}
This is O(n) in string length with no memory overhead. The tool processes input in real time as you type. No data is sent to any server.
Variants: ROT5, ROT18, ROT47
- ROT5: Rotates digits 0–9 by 5.
12345becomes67890. - ROT18: Combines ROT13 (letters) + ROT5 (digits). Both letters and numbers are rotated.
- ROT47: Rotates all printable ASCII characters (33–126) by 47. This covers letters, digits, and symbols, but produces less readable output.
This tool implements standard ROT13 (letters only), which is the most widely recognized variant.