Caesar Cipher - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim

Caesar Cipher

Main Concept

The Caesar Cipher is one of the simplest and most widely known encryption techniques. It is a form of substitution cipher in which each letter of the original text, known as the "plaintext", is replaced by a letter some fixed number of positions further down the alphabet. This technique is named after Julius Caesar, who used it with a left shift of 3 to protect messages of military significance.

Decryption occurs by performing a shift of the same magnitude but in the opposite direction on each letter of the encrypted text, known as the "ciphertext".


For example, with a right shift of 3: A would be replaced with D, B would be replaced with E, and so on until W is replaced with Z. Then, the beginning of the alphabet must wrap around so that X is replaced with A, Y is replaced with B, and finally, Z is replaced with C.


Encryption using a Caesar cipher can be represented using modular arithmetic by first transforming the letters of the alphabet into numbers with A = 0, B = 1, C = 2, ... , Y = 24, Z = 25.

Encryption of the letter x with a shift of n can be described as:

Enx = x + n mod 26

Decryption of the same letter x with a shift of n can then be described as:


Dnx = x  n mod 26


Like all types of monoalphabetic substitution, encryptions made using a Caesar cipher can be easily broken through the frequency analysis of letters and brute force attacks.

The black letters below illustrate the normal position of the letters of the alphabet, while the dark blue letters illustrate the shifted position of these letters in a Caesar cipher. Use the slider to adjust the magnitude of the shift, then type your message into the "Plaintext" text box and press the "Encrypt Text" button to transform it into the corresponding ciphertext.

Right Shift:



More MathApps