🔐 ROT13 Encoder & Decoder

Transform text using the self-reversible ROT13 cipher - Perfect for hiding spoilers and basic text obfuscation

📥 Input Text 0 characters
📤 Output Text 0 characters

⚙️ Options

🎯 ROT13 Alphabet Mapping

ROT13 replaces each letter with the letter 13 positions after it. Since there are 26 letters, applying ROT13 twice returns the original text.

🏛️ What is ROT13?

ROT13 ("rotate by 13 places") is a special case of the Caesar cipher with a fixed shift of 13. It's widely used in online forums and newsgroups to hide spoilers, puzzle solutions, and punchlines.

Simple substitution cipher

Each letter is replaced by another letter 13 positions away in the alphabet.

Self-reversible

Apply ROT13 twice to get the original text back - same operation for encoding and decoding.

Case-preserving

Uppercase letters remain uppercase, lowercase letters remain lowercase.

Widely supported

Used across platforms, forums, and text editors for quick obfuscation.

⚙️ How It Works

Each letter is replaced by the letter 13 positions ahead in the alphabet. When reaching the end, it wraps around to the beginning:

  • A ↔ N, B ↔ O, C ↔ P, etc.
  • Numbers and symbols remain unchanged (unless option enabled)
  • Mathematical formula: (x + 13) mod 26
  • Same process for encoding and decoding

🔐 Security & Usage

ROT13 provides no cryptographic security and is trivially broken. However, it's perfect for: and is trivially broken. However, it's perfect for:

🎬 Hiding spoilers

Prevent accidental reading of movie, book, or game spoilers in forums.

📧 Email obfuscation

Obscure email addresses from spam bots on websites.

🎓 Teaching cryptography

Introduce basic encryption concepts to students.

🎮 Puzzles & games

Create simple word puzzles and riddles.

❓ Frequently Asked Questions

What makes ROT13 different from other Caesar ciphers?
ROT13 is unique because it uses a shift of exactly 13, which is half of the 26-letter alphabet. This means the same operation both encodes and decodes text - applying ROT13 twice returns the original message. This self-reversible property makes it particularly convenient for quick obfuscation tasks.
Is ROT13 secure for protecting sensitive information?
No, ROT13 provides absolutely no cryptographic security. It's trivially easy to decode and should never be used for protecting passwords, personal information, or confidential data. It's meant only for hiding spoilers, puzzle answers, or obscuring text that you don't want accidentally read.
Why is ROT13 still used if it's not secure?
ROT13 is perfect for scenarios where you want to hide information from casual viewing without needing real security. Common uses include: hiding movie/book spoilers in online discussions, obscuring email addresses from spam bots, creating simple word puzzles, and teaching cryptography basics. Its simplicity and self-reversible nature make it ideal for these purposes.
Can ROT13 encode numbers and special characters?
Traditional ROT13 only transforms letters (A-Z, a-z) and leaves numbers, spaces, and special characters unchanged. However, there are extended versions like ROT18 that include number rotation (0-9), and ROT47 that includes more ASCII characters. Our tool offers an optional setting to process numbers using a 5-digit rotation (0↔5, 1↔6, etc.).
How do I decode ROT13 text?
Since ROT13 is self-reversible, you decode it the exact same way you encode it - just apply ROT13 again! Simply paste the encoded text into the input field and click "Process ROT13". The beauty of ROT13 is that there's no separate encode/decode operation needed.
Where is ROT13 commonly used today?
ROT13 is widely used in: online forums and discussion boards (Reddit, Stack Exchange) for hiding spoilers; geocaching puzzles and mystery caches; email address obfuscation on websites; Unix/Linux systems (built into editors like vim); programming exercises and coding challenges; and educational settings to teach basic encryption concepts.

💻 ROT13 in Different Programming Languages

Python

import codecs # Method 1: Using codecs text = "Hello World" encoded = codecs.encode(text, 'rot13') print(encoded) # Output: Uryyb Jbeyq # Method 2: Manual implementation def rot13(text): result = [] for char in text: if char.isalpha(): offset = 65 if char.isupper() else 97 result.append(chr((ord(char) - offset + 13) % 26 + offset)) else: result.append(char) return ''.join(result) print(rot13("Hello World")) # Output: Uryyb Jbeyq

JavaScript

function rot13(str) { return str.replace(/[a-zA-Z]/g, function(char) { const code = char.charCodeAt(0); const offset = code >= 65 && code <= 90 ? 65 : 97; return String.fromCharCode((code - offset + 13) % 26 + offset); }); } console.log(rot13("Hello World")); // Output: Uryyb Jbeyq

PHP

<?php // Method 1: Using str_rot13 $text = "Hello World"; $encoded = str_rot13($text); echo $encoded; // Output: Uryyb Jbeyq // Method 2: Manual implementation function rot13_manual($str) { $result = ''; for ($i = 0; $i < strlen($str); $i++) { $char = $str[$i]; if (ctype_alpha($char)) { $offset = ord(ctype_upper($char) ? 'A' : 'a'); $result .= chr((ord($char) - $offset + 13) % 26 + $offset); } else { $result .= $char; } } return $result; } ?>

Java

public class ROT13 { public static String encode(String text) { StringBuilder result = new StringBuilder(); for (char c : text.toCharArray()) { if (Character.isLetter(c)) { char offset = Character.isUpperCase(c) ? 'A' : 'a'; result.append((char) ((c - offset + 13) % 26 + offset)); } else { result.append(c); } } return result.toString(); } public static void main(String[] args) { System.out.println(encode("Hello World")); // Output: Uryyb Jbeyq } }

C++

#include <iostream> #include <string> #include <cctype> std::string rot13(const std::string& text) { std::string result; for (char c : text) { if (std::isalpha(c)) { char offset = std::isupper(c) ? 'A' : 'a'; result += (c - offset + 13) % 26 + offset; } else { result += c; } } return result; } int main() { std::cout << rot13("Hello World") << std::endl; // Output: Uryyb Jbeyq return 0; }

Linux/Unix Command Line

# Using tr command echo "Hello World" | tr 'A-Za-z' 'N-ZA-Mn-za-m' # Output: Uryyb Jbeyq # Decode (same command) echo "Uryyb Jbeyq" | tr 'A-Za-z' 'N-ZA-Mn-za-m' # Output: Hello World # Process a file cat input.txt | tr 'A-Za-z' 'N-ZA-Mn-za-m' > output.txt

📚 Historical Context

ROT13 became popular on Usenet in the 1980s as a way to hide potentially offensive content. It's described as the "Usenet equivalent of printing an answer upside down."

  • Originated in early internet culture
  • Still used in modern forums and discussion boards
  • Built into many text editors (like Vim)
  • Standard in Unix utilities

🔗 Related Cipher Tools