ROT13 Encoding Basics

Learn how ROT13 works by rotating each letter 13 positions in the alphabet. Understand why ROT13 is self-reciprocal and how it handles uppercase, lowercase, and non-alphabetic characters.

ROT13 Fundamentals

Detailed Explanation

What Is ROT13?

ROT13 ("rotate by 13 places") is the most popular variant of the Caesar cipher. It replaces each letter in the English alphabet with the letter exactly 13 positions after it, wrapping around from Z back to A.

The Substitution Table

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

For lowercase letters, the same mapping applies: a becomes n, b becomes o, etc.

Self-Reciprocal Property

Because the English alphabet has 26 letters and 13 is exactly half of 26, applying ROT13 twice returns the original text:

"Hello" → ROT13 → "Uryyb" → ROT13 → "Hello"

This means the same function is used for both encoding and decoding. No separate decrypt operation is needed.

Non-Alphabetic Characters

Digits, punctuation, spaces, and any non-English-letter characters are left completely unchanged:

"Hello, World! 123" → "Uryyb, Jbeyq! 123"

Mathematical Formulation

For an uppercase letter with position p (A=0, B=1, ..., Z=25):

encrypted = (p + 13) mod 26

Because (p + 13 + 13) mod 26 = (p + 26) mod 26 = p, the operation is its own inverse.

Use Case

ROT13 basics are essential knowledge for anyone working with text encoding, internet culture, or introductory cryptography. Understanding how ROT13 works is the first step toward grasping more complex substitution ciphers and encryption algorithms.

Try It — ROT13 / Caesar Cipher

Open full tool