TR

Home / Guides / What Are ROT13 and the Caesar Cipher? Worked Example, Cracking Method and Limits

What Are ROT13 and the Caesar Cipher? Worked Example, Cracking Method and Limits

Updated: November 6, 2026 · AracMerkezi

▶ Open ROT13 and Caesar Cipher

The Caesar cipher is one of the oldest known encryption methods. It shifts every letter forward in the alphabet by a fixed number of places so the text becomes unreadable. ROT13 is the special case that shifts by 13 letters. Today it is used not for real security but for puzzles, teaching and fun. This guide shows how to apply the method by hand and in code, what changes with the Turkish alphabet, and why the cipher can be broken in a few minutes.

How does the Caesar cipher work?

You pick a key (the shift). Every letter moves forward by that many places in the alphabet. When you pass the end of the alphabet you wrap around to the start. If you number the letters A=0, B=1, C=2 ... Z=25, the rule is one line:

Cipher index = (plain index + key) mod 26, and to decrypt, plain index = (cipher index − key) mod 26.

“mod 26” describes the wrap-around: with key 3, X, Y, Z become A, B, C, because for Y we get (24 + 3) = 27 and 27 − 26 = 1, which is B.

Step-by-step example: MERHABA, key 3

The table below shows how each letter changes (26-letter Latin alphabet):

Plain letterIndexIndex + 3Cipher letter
M1215P
E47H
R1720U
H710K
A03D
B14E
A03D

The result is PHUKDED. To decrypt, subtract the same number: P (15) − 3 = 12 = M, and so on. The most common mistake when working by hand is forgetting to wrap around near the end of the alphabet, so test with letters such as Z, Y and X separately.

What is ROT13?

ROT13 is the Caesar cipher with a shift of 13. Because the Latin alphabet has 26 letters, 13 is exactly half of it; since 13 + 13 = 26, applying the same operation twice returns the original text. Encrypting and decrypting are the same operation. Example: MERHABA → ZREUNON → ROT13 again → MERHABA. Only the letters A–Z change; digits, spaces and Turkish letters such as ü and ö stay as they are: “Merhaba Dünya” → “Zreunon Qüaln”.

ROT13 was used on internet forums to hide a puzzle’s answer or “spoiler” so readers would not see it by accident. We tried the following one-line methods and all of them gave the same result:

Caesar with the Turkish alphabet: 29 letters

The Turkish alphabet has 29 letters (including Ç, Ğ, İ, Ö, Ş, Ü; there is no q, w or x). Classic ROT13 and most tools use the 26-letter Latin alphabet and leave the special letters unchanged. A Caesar shift on the Turkish alphabet (A B C Ç D E F G Ğ H I İ J K L M N O Ö P R S Ş T U Ü V Y Z) gives different output: MERHABA with key 3 becomes ÖĞTJÇDÇ, because three places after M is Ö. The modulus here is 29; since 29 is odd there is no “half alphabet”, and applying a shift of 13 twice does not restore the text (MERHABA → ZÖDŞKLK → JCOFVYV). If you are preparing a puzzle, make sure the solver uses the same alphabet and the same rule. The tool on our site offers both a 26-letter and a 29-letter alphabet.

How do you break a Caesar cipher?

Method 1: brute force. In a 26-letter alphabet there are 25 meaningful keys; you try the 25 shifts in order and pick the one that yields a meaningful word. For “PHUKDED”, the first three attempts:

Attempt (shift back)Resulting text
1OGTJCDC
2NFSIBCB
3MERHABA

The third row produced a readable word, so the key is 3. Even by hand, 25 attempts take a few minutes; for a computer it is a fraction of a second.

Method 2: frequency analysis. If the plain text is Turkish, the letters A and E appear very often. Example: encrypting the sentence “BUGUN AKSAM SAAT ALTIDA ANKARADA BULUSALIM” with key 5 gives “GZLZS FPXFR XFFY FQYNIF FSPFWFIF GZQZXFQNR”. The most frequent letter in the cipher text is F (11 times). If we assume the most frequent plain letter is A, the shift is F − A = 5; shifting the text back by 5 makes the sentence readable. With short texts this guess can be wrong; with long texts it is reliable.

Why is it not secure?

So do not use the Caesar cipher for passwords, personal data or secret information. Real security needs current, audited encryption libraries. For password generation, see the secure password guide.

Difference from Base64 and Base32

The Caesar cipher shifts letters, whereas Base64 and Base32 merely encode data with a different character set. None of them provides security without a key:

Common mistakes

Glossary

Quick try

With the ROT13 and Caesar Cipher tool you can encrypt and decrypt your text with any shift you like. For encoding, see the Base64 Encode/Decode and Base32 Encode/Decode tools. If you are curious about the difference from hashing, read the guide What Is a Hash?. This article is for educational purposes; consult expert sources for security decisions.

Frequently asked questions

Why does ROT13 return to the original text when applied twice?

The Latin alphabet has 26 letters and 13 is exactly half; two shifts of 13 make 26, so you return to the starting point. The 29-letter Turkish alphabet does not have this property.

Is the Caesar cipher secure?

No; a 26-letter alphabet has only 25 possible shifts and letter frequency does not change, so it can be broken quickly even by hand.

Is Base64 encryption?

No; Base64 is only an encoding format and has no key, so it provides no security.

Tools mentioned in this guide

More guides

This article is for general information only and is not legal, financial or medical advice. We are not an official institution.