Leandro Junes

Caesar Cipher

Shift each letter of the alphabet by a fixed amount.

With A = 0, B = 1, …, Z = 25,

Encryption E(x) = x + k (mod 26)

Decryption D(x) = x − k (mod 26)

Calculator

—
Mode

See the shift

—
Top row plain alphabet (your input) Bottom row cipher alphabet (the output)

How your message is transformed

—
Position Input letter Number Calculation (mod 26) Result number Output letter

Position counts letters only; spaces, digits, and punctuation are not shifted and are left out of the table.

Why does the alphabet wrap around?

What happens to letter frequencies?

A Caesar cipher preserves the frequency pattern of the plaintext; it only shifts which alphabet letters carry those frequencies. If E is the most common letter of the message, then with k = 3 the most common ciphertext letter is H, and every other letter's count moves along with it.

That is why counting letters is enough to recover the shift without trying all 26.

Frequency Analysis

The Caesar cipher is a special case of the affine cipher E(x) = ax + b (mod 26) with a = 1 and b = k.

Affine Cipher