Caesar Cipher Shift
Shift each letter forward by k positions.
Formula
Variables
Example
m=0 (A), k=3: c = 3 (D)
How it works
This formula describes how a Caesar cipher turns a plaintext letter into a ciphertext letter by moving it forward a fixed number of places in the alphabet. The letters are treated as numbers from 0 to 25, so adding the shift k moves the position, and the modulo 26 wraps around when you pass Z. That wraparound is what makes the alphabet cycle back to the beginning instead of running out of letters.
When to use it
Use this when encoding or decoding a simple Caesar cipher in cryptography lessons, puzzles, or introductory programming exercises. It also helps when you need a quick way to model letter shifting with circular counting.
Worked example, step by step
Let m = 22 (W) and k = 5 c = (m + k) mod 26 c = (22 + 5) mod 26 c = 27 mod 26 c = 1 So the ciphertext letter is 1, which corresponds to B.
Common mistakes to avoid
- Forgetting to apply mod 26 and ending up with numbers bigger than 25
- Mixing up the letter-to-number mapping, such as using A = 1 instead of A = 0 without adjusting the formula
- Shifting in the wrong direction when encoding or decoding
Did You Know?
Julius Caesar shifted letters by three to protect military messages over two thousand years ago.
Share this formula
More in Cryptography & Security
View allModular Exponentiation
IntermediateCore operation of RSA encryption — raise a message to a power, modulo n.
RSA Decryption
AdvancedRecovers the message using the private exponent d.
Euler's Totient
IntermediateCounts integers below n coprime to it, for n = pq — used to make RSA keys.
Shannon Entropy
AdvancedAverage information content — and the theoretical strength of a random source.
Password Entropy
IntermediateBits of security from password length and character-set size.
Key Space Size
IntermediateNumber of possible keys for a b-bit key.