Caesar Cipher

Text

Cipher

How Does the Caesar Cipher Work?

The Caesar Cipher is one of the simplest and oldest encryption techniques. It works by shifting the letters of the alphabet by a fixed amount. For example, with a shift of 3, the letter A becomes D, B becomes E, and so on.

This method was used by Julius Caesar to send confidential messages to his allies. However, due to its simplicity, it is very easy to break with modern techniques.

The formula to encrypt a letter is: E(x) = (x + n) mod 26, where x is the letter's position in the alphabet, and n is the number of positions to shift.

Example

If we use a shift of 3 on the word HELLO:

H → K, E → H, L → O, L → O, O → R

The encrypted message is: KHOOR