Log in Sign up
Back to Discover
🔢

Caesar cipher

math Maturity 11-13

You can hide a secret note.

Caesar cipher left shift of 3.svg
Caesar cipher left shift of 3.svg
You swap each letter for a new one. A man named Caesar used this. It helps keep a message safe. It is like a fun game. Do you want to try it?

44 words

You can hide a secret note.

Caesar cipher left shift of 3.svg
Caesar cipher left shift of 3.svg
You swap each letter for a new one. A man named Julius Caesar used this. He used it for his private letters.
Bust of Julius Caesar from History of the World (1902).png
Bust of Julius Caesar from History of the World (1902).png
He would shift the alphabet by three places. This way, a message stayed safe. It is a very simple way to hide words. You can even find this in toys today. Some toys use secret decoder rings. It is a fun way to play with letters.

90 words

Imagine you want to send a secret note.

Caesar cipher left shift of 3.svg
Caesar cipher left shift of 3.svg
You could use a Caesar cipher. This is a way to hide words. It is a type of substitution cipher. This means you swap each letter for a different one. You move the alphabet by a set number of spots.
Bust of Julius Caesar from History of the World (1902).png
Bust of Julius Caesar from History of the World (1902).png
This method is named after Julius Caesar. He used it for his private letters. He often shifted the alphabet by three places. His nephew Augustus used a different shift. Augustus only shifted by one spot.

This code is very easy to break. You can try every possible shift until the words make sense. This is called a brute force attack. People also use frequency analysis to solve it. This means they look at how often letters appear.

English letter frequency percentages.png
English letter frequency percentages.png
In English, some letters show up more than others. You can use these patterns to find the shift. Even though it is old, we still see it today. You might find it in secret decoder rings. Some people even use a version called ROT13 to hide spoilers online.

193 words

Imagine you want to send a secret message to a friend. You do not want anyone else to read it. You could use a special way to hide your words. This is called a Caesar cipher. It is a type of substitution cipher. This means you swap every letter for a new one. You pick a fixed number of spots to move down the alphabet.

Caesar cipher left shift of 3.svg
Caesar cipher left shift of 3.svg
For example, you might move every letter three spots to the left. This turns an A into a D. It turns a B into an E. This simple trick makes your message look like nonsense to others.

To use this code, you need a key. The key is the number of spots you shift the alphabet. You can imagine two lines of alphabets sitting one above the other. The top line is your plain message. The bottom line is your secret code. To encrypt, you find your letter on the top line. Then you write down the letter directly below it.

Confederate cipher disk.jpg
Confederate cipher disk.jpg
To read the secret message, you just do the opposite. You move the letters back the same number of spots. This is called deciphering. It is a very steady and predictable way to change text.

This method is named after the famous leader Julius Caesar. A Roman historian named Suetonius wrote about how Caesar used it. Caesar used a shift of three to protect important military messages. His nephew Augustus also used a secret code. Augustus used a shift of only one spot. However, Augustus did not wrap around to the start of the alphabet. The grammarian Aulus Gellius even mentioned that Caesar used more complicated systems too.

Bust of Julius Caesar from History of the World (1902).png
Bust of Julius Caesar from History of the World (1902).png
These old stories show how people have always valued secrets.

Even though it is old, the Caesar cipher is very easy to break. An attacker can use a brute force attack. This means they try every possible shift one by one. There are only 25 possible shifts in the English alphabet. They just keep trying until the words make sense. Another way to break it is called frequency analysis.

English letter frequency percentages.png
English letter frequency percentages.png
In English, some letters like E appear much more often than others. If you see a pattern in the letters, you can guess the shift. This makes the code very weak for modern use.

We still see versions of this idea in our world today. You might find secret decoder rings in a toy box. Some people use a version called ROT13 to hide spoilers online. This version shifts the alphabet by thirteen spots. It is also used in more complex schemes like the Vigenère cipher. In the 1915 era of World War I, the Russian army used it too. It was easy for soldiers to learn, even if it was easy to break. It shows how simple ideas can last for a very long time.

492 words

A Caesar cipher is a method of encryption used to hide the meaning of a message. It is a type of monoalphabetic substitution cipher. In this system, every letter in a message is replaced by a different letter. This replacement happens by shifting the alphabet a fixed number of positions. This method is one of the simplest and most famous techniques in the field of cryptography.

Caesar cipher left shift of 3.svg
Caesar cipher left shift of 3.svg

To understand the mechanism, imagine two lines of alphabets aligned with one another. The first line contains the standard plain alphabet. The second line is the cipher alphabet, which is the plain alphabet shifted left or right by a specific number. This number is known as the shift parameter or the key. For example, a left shift of three replaces A with X, B with Y, and C with Z. To encrypt a message, a person looks up each letter in the plain line. They then write down the corresponding letter from the cipher line.

Confederate cipher disk.jpg
Confederate cipher disk.jpg

Deciphering is the process of reversing this transformation. If the message was encrypted with a left shift of three, it is decrypted with a right shift of three. This process can also be described using modular arithmetic. First, letters are transformed into numbers where A is 0 and Z is 25. The encryption of a letter $x$ by a shift $n$ is calculated as $(x + n) \pmod{26}$. To decrypt, the formula is $(x - n) \pmod{26}$. If the result falls outside the 0 to 25 range, 26 is added or subtracted to keep it within bounds.

This method is named after Julius Caesar. According to the Roman historian Suetonius, Caesar used a shift of three to protect messages of military significance. His nephew, Augustus, also used a cipher. Augustus used a right shift of one, but he did not wrap the alphabet around to the beginning. While Caesar is the most famous user, other substitution ciphers existed earlier. The grammarian Aulus Gellius even suggested that Caesar used more complicated systems beyond this simple shift.

Bust of Julius Caesar from History of the World (1902).png
Bust of Julius Caesar from History of the World (1902).png

Despite its history, the Caesar cipher is very easy to break in modern practice. One method is a brute force attack. Because there are only 25 possible shifts in the English alphabet, an attacker can simply try every single one. They look for the shift that produces meaningful text. Another method is frequency analysis. This relies on the fact that certain letters appear more often than others in a language.

English letter frequency percentages.png
English letter frequency percentages.png
By graphing the frequency of letters in the ciphertext, a person can match the pattern to the known distribution of the original language.

History shows that even when the cipher was known to be weak, it was still used. During World War I in 1915, the Russian army used it because it was easy for troops to master. However, German and Austrian cryptanalysts found it very easy to decrypt. In more recent history, the cipher has appeared in unexpected places. In 2006, the Mafia boss Bernardo Provenzano was captured partly because of a variation of the cipher. In 2011, a British Airways employee was convicted of terrorism offenses after using a Caesar cipher to discuss plots.

The Caesar cipher also serves as a building block for more advanced systems. The Vigenère cipher is a polyalphabetic substitution that uses a different Caesar shift for each position in the text. This shift is determined by a repeating keyword. If a keyword is as long as the message and is never reused, it becomes a one-time pad, which is impossible to break. Today, a version called ROT13 uses a shift of thirteen. It is often used on the internet to hide spoilers or joke punchlines, though it offers no real security.

637 words
🖼️ Images & Media (4)
File:Caesar cipher left shift of 3.svg
Caesar cipher left shift of 3.svg
File:Bust of Julius Caesar from History of the World (1902).png
Bust of Julius Caesar from History of the...
File:Confederate cipher disk.jpg
Confederate cipher disk.jpg
File:English letter frequency percentages.png
English letter frequency percentages.png
Up Next
🔢
Asymptotic analysis
Math
More to explore

What is Nepedia?

A free, ad-free encyclopedia for children. Every article is written at five reading levels, so the same page works for a five-year-old and a fifteen-year-old — use the level switcher above to see this one change. No account needed to read.