Caesar Cipher

Encrypt and decrypt text using the Caesar cipher with a customizable shift value.

The Caesar Cipher tool lets you encrypt and decrypt text by shifting each letter in the alphabet by a specified number of positions. Named after Julius Caesar who used it for military communications, this classic substitution cipher is perfect for learning about cryptography fundamentals. Adjust the shift value from 1 to 25 and toggle between encrypt and decrypt modes instantly in your browser.

Loading...
Your data stays in your browser
Tutorial

How to Use

1
1

Enter your text

Type or paste the text you want to encrypt or decrypt into the input area.

2
2

Set the shift value

Use the slider to choose a shift between 1 and 25 letters for the cipher.

3
3

Choose mode and copy

Toggle encrypt or decrypt mode, then copy the transformed result to your clipboard.

Guide

Complete Guide to the Caesar Cipher

History of the Caesar Cipher

The Caesar cipher is one of the oldest known encryption techniques, used by Julius Caesar to communicate with his generals around 50 BC. According to the Roman historian Suetonius, Caesar shifted each letter by three positions. Despite its simplicity, it was effective in an era when most adversaries were illiterate. The cipher remained in use by various militaries for centuries before frequency analysis made it trivially breakable.

How the Algorithm Works

The Caesar cipher applies a fixed shift to each letter in the plaintext. For encryption with shift N, each letter is replaced by the letter N positions ahead in the alphabet, wrapping around from Z to A. Mathematically, for a letter at position P, the encrypted position is E = (P + N) mod 26. Decryption reverses the process: D = (P - N) mod 26. Non-alphabetic characters remain unchanged.

Cryptanalysis and Weaknesses

The Caesar cipher has only 25 possible keys, making brute-force attacks trivial — simply try all 25 shifts and read the results. Frequency analysis provides an even faster approach: in English, the letter E appears most frequently at about 12.7%. By finding the most common letter in the ciphertext and assuming it maps to E, the shift value can be deduced immediately without trying all combinations.

From Caesar to Modern Encryption

The Caesar cipher evolved into more complex polyalphabetic ciphers like the Vigenere cipher, which uses multiple shift values determined by a keyword. This lineage continued through the Enigma machine used in World War II and eventually led to modern symmetric encryption algorithms like AES. While the Caesar cipher itself is insecure, it teaches the fundamental concept of key-based transformation that underpins all modern cryptography.
Examples

Worked Examples

Example: Encrypting with Shift 3

Given: The plaintext 'ATTACK AT DAWN' with shift 3

1

Step 1: A(0) + 3 = D(3), T(19) + 3 = W(22), T(19) + 3 = W(22), A(0) + 3 = D(3), C(2) + 3 = F(5), K(10) + 3 = N(13)

2

Step 2: Space stays as space

3

Step 3: A(0) + 3 = D(3), T(19) + 3 = W(22)

4

Step 4: D(3) + 3 = G(6), A(0) + 3 = D(3), W(22) + 3 = Z(25), N(13) + 3 = Q(16)

Result: 'ATTACK AT DAWN' becomes 'DWWDFN DW GDZQ'

Example: Decrypting with Shift 3

Given: The ciphertext 'DWWDFN DW GDZQ' with shift 3

1

Step 1: D(3) - 3 = A(0), W(22) - 3 = T(19), W(22) - 3 = T(19), D(3) - 3 = A(0), F(5) - 3 = C(2), N(13) - 3 = K(10)

2

Step 2: Space stays as space

3

Step 3: Continue decrypting each remaining letter by subtracting 3 from its position

Result: 'DWWDFN DW GDZQ' decrypts back to 'ATTACK AT DAWN'

Use Cases

Use Cases

Sending coded messages

Create fun coded messages for friends or team members by encrypting text with a secret shift value. Share the shift number separately so only the intended recipient can decode the message. Great for birthday surprise planning or team building activities.

Learning classical cryptography

Use this tool as a hands-on educational aid when studying the history of encryption. Experiment with different shift values to understand how substitution ciphers work, why they are vulnerable to frequency analysis, and how they evolved into more complex modern algorithms.

Creating puzzle games

Design escape room clues, treasure hunts, or classroom puzzles using Caesar-encrypted messages. Players must figure out the shift value to decode the clue and advance to the next challenge. The visual mapping display helps verify solutions quickly.

Frequently Asked Questions

?What is the Caesar cipher?

It is a substitution cipher where each letter shifts by a fixed number of positions in the alphabet, named after Julius Caesar.

?Is the Caesar cipher secure?

No. With only 25 possible shifts, it can be broken by trying all possibilities or using frequency analysis on the text.

?What shift did Caesar actually use?

Historical records suggest Julius Caesar used a shift of 3, replacing A with D, B with E, and so on.

?Does it work with numbers and symbols?

Numbers, spaces, and symbols pass through unchanged. Only alphabetic letters A through Z are shifted by the cipher.

?How do I decrypt a Caesar cipher message?

Switch to decrypt mode and use the same shift value that was used for encryption to recover the original text.

?Is this tool free to use?

Yes, it is completely free with no usage limits. Encrypt and decrypt as many messages as you want.

?Is my data private when using this tool?

Yes. All processing runs locally in your browser. No text is sent to any server or stored anywhere.

?What is ROT13?

ROT13 is a Caesar cipher with shift 13. Since the alphabet has 26 letters, applying ROT13 twice returns the original text.

Related Tools

Recommended Reading

Recommended Books on Ciphers & Cryptography

As an Amazon Associate we earn from qualifying purchases.

Boost Your Capabilities

Recommended Products for Cryptography Enthusiasts

As an Amazon Associate we earn from qualifying purchases.

How do you like this tool?

Newsletter

Get Free Productivity Tips & New Tools First

Join makers and developers who care about privacy. Every issue: new tool drops, productivity hacks, and insider updates — no spam, ever.

Priority access to new tools
Unsubscribe anytime, no questions asked