Tech

Caesar Cipher

It's a secret note where you slide the whole alphabet a few spots over, so only people who know the rule can read it.

  • 3 min read
  • 1 figures
  • Verified 2026-10-13

Definition

The Caesar cipher is one of the oldest and most basic ways to encrypt a message: you shift every letter a fixed number of places down the alphabet to turn it into a different letter. It hides the original letters, but anyone who knows how many places you shifted can read the message right back.

A Secret Note Made by Sliding the Alphabet

Imagine you and a friend agree to pass secret notes by shifting every letter one spot over. You write B instead of A, and D instead of C. A word like CAT turns into DBU, and nobody else can make sense of it at a glance.

Julius Caesar, the Roman general, is said to have used this very trick for his important, confidential letters. He wrote his secret messages by shifting each letter of the alphabet three places forward.

So 'A' becomes 'D', and 'B' becomes 'E'. 'Z' at the end of the alphabet wraps back around to the start and becomes 'C'. Swapping each letter for one fixed replacement letter like this is called a substitution cipher, and the Caesar cipher is the simplest form of it. It was a smart safeguard: even if an enemy captured the messenger, they couldn't read the letter.

One Key to Lock and Unlock: The Ancestor of Symmetric Encryption

In cryptography, the normal sentence anyone can read is called 'plaintext,' and the scrambled version is called 'ciphertext.' Turning plaintext into ciphertext is 'encryption,' and turning it back is 'decryption.'

The key idea in the Caesar cipher is 'how many places you shifted.' In cryptography, that number of places is called the secret key. If the key is 3, you shift three places. If the key is 5, you shift five places.

The sender and the receiver both need to know the same key number ahead of time. If the message was encrypted with a 3-place shift, the receiver shifts 3 places back to decrypt it. Because both sides use the same key, the Caesar cipher can be seen as a primitive ancestor of today's widely used symmetric encryption.

To Be More Precise: Why Can't We Use It Today?

To be more precise, the Caesar cipher isn't safe at all in today's computer world. The English alphabet has only 26 letters, so there are only 25 possible shifts, from 1 place to 25 places.

An attacker doesn't even need a computer. Writing out all 25 possibilities by hand on paper takes very little time. Trying every possible option one by one until you find the answer is called a brute-force attack.

A language with more letters doesn't fix the problem either. Everyday language uses some letters far more often than others, so a frequency analysis attack, which looks for the most common letter in the ciphertext, quickly reveals the original sentence. That's why modern encryption doesn't just slide letters sideways. It relies on hard, complex math and secret keys with an astronomical number of possibilities.

Common misconceptions

Myth

The Caesar cipher was a perfect, unbreakable code in the days before computers.

Fact

In principle, it's a weak cipher. With only 25 possible shifts in the alphabet, you can break it without a computer by trying each shift or by analyzing how often each letter appears. It likely worked to some degree back then simply because these code-breaking methods weren't widely known.

Where you meet it

  1. With a secret key of 3, the English word 'CAT' is shifted three places forward and becomes 'FDW'.

  2. 'ROT13,' which shifts letters 13 places and is used on internet forums to hide spoilers, is a type of Caesar cipher.

In one sentence

The Caesar cipher is one of the most basic symmetric ciphers: it hides a message by shifting each letter a fixed number of places.

Created 2025-03-21 Updated 2026-10-13 Verified 2026-10-13