Caesar Cipher

The calculator shifts each A–Z letter by n places. ABC at 1 gives BCD. HELLO at 3 gives KHOOR. This is not Morse code.

Dots and dashes are on the Morse code translator. A character number is on ASCII and Unicode.

Inputs

Result

Enter a shift and text. The result will appear here.

How it works

The calculator shifts each A–Z letter by n places in the Latin alphabet. ABC at 1 gives BCD.

HELLO at 3 gives KHOOR. Decoding KHOOR at 3 returns HELLO.

After Z the alphabet wraps to A, so XYZ at 3 gives ABC. 29 is the same as 3, because 29 modulo 26 is 3.

A space stays a space. The calculator does not accept a digit or a Polish letter. This is not Morse.

Lowercase stays lowercase: abc at 1 is bcd.

A negative n moves backward. −1 from BCD gives ABC.

Formula

E(x) = (x + n) mod 26, D(x) = (x − n) mod 26

x is the letter position from 0 (A) to 25 (Z). n is an integer.

How to use

  1. Choose encode and enter shift 1.
  2. In the text field enter ABC and calculate. The result is BCD.
  3. To get KHOOR, change n to 3 and the text to HELLO.
  4. To get HELLO back, choose decode, keep 3, and paste KHOOR.

HELLO at 3 is KHOOR

That is the classic Caesar shift. n = 3.

BCD
ABC at n = 1.
KHOOR
HELLO at n = 3.
ABC
XYZ at n = 3, after the alphabet wraps.

Examples

Example 1

  • Encode
  • n = 1
  • ABC

BCD

What does ABC become at shift 1? BCD.

Example 2

  • Encode
  • n = 3
  • HELLO

KHOOR

What does HELLO become at shift 3? KHOOR.

Example 3

  • Decode
  • n = 3
  • KHOOR

HELLO

What comes back from KHOOR at shift 3 backward? HELLO.

Related calculators

Frequently asked questions

What does ABC become at shift 1?

BCD. A goes to B, B to C, C to D.

What does HELLO become at shift 3?

KHOOR. That is the classic +3. H→K, E→H, L→O, O→R.

What comes back from KHOOR at shift 3 backward?

HELLO. Decode subtracts the same n.

What about XYZ at shift 3?

ABC. After Z the alphabet wraps to A.

Is 29 a different cipher than 3?

No. 29 modulo 26 is 3. The result is the same.

Does a space shift?

No. A space stays a space. Only A–Z letters move.

Does the calculator shift Ą or the digit 5?

No. This page uses the Latin A–Z alphabet. Polish letters and digits are not here.

Is this Morse?

No. Morse turns a letter into dots and dashes. Here the letter stays a letter, only shifted.

Do lowercase letters stay lowercase?

Yes. abc at 1 gives bcd. Case does not change.

Does a negative n work?

Yes. −1 from BCD gives ABC. That is the same as decode at 1.

What if I do not know the shift?

Under the result there is a list of 26 subtractions from the same text. You look for the sentence that makes sense.

Sources

The Caesar cipher is a shift modulo 26. The classic n is 3.

Page updated in 2026.