Omni Calculator logo

Who created the Caesar cipher? History of shift ciphers

As everybody knows, it was Gaius Julius Caesar, the great Roman general and dictator, who created the Caesar cipher to protect the privacy of letters sent to his friends and family members, as well as battlefield orders. That's it, we're done, right?

Well, not so fast. The origin of the Caesar cipher is much more fascinating and obscured by the passage of time.

All that we know for sure is the following passage from a Roman historian, Suetonius:

Extant et ad Ciceronem, item ad familiares domesticis de rebus, in quibus, si qua occultius perferenda erant, per notas scripsit, id est sic structo litterarum ordine, ut nullum verbum effici posset: quae si qui investigare et persequi velit, quartam elementorum litteram, id est D pro A et perinde reliquas commutet.
Suetonius (Divus Iulius 56)

Which translates in the language of Shakespeare as follows:

There are also letters of his to Cicero, as well as to his intimates on private affairs, and in the latter, if he had anything confidential to say, he wrote it in cipher, that is, by so changing the order of the letters of the alphabet, that not a word could be made out. If anyone wishes to decipher these, and get at their meaning, he must substitute the fourth letter of the alphabet, namely D, for A, and so with the others.
(Suetonius, The Life of Julius Caesar, Loeb Classical Library, 1913)

To summarize:

  • Suetonius gives the earliest known description of somebody using a shift cipher, and this person was Caesar himself.
  • The idea of cyclic letter substitution is probably much, much older, and nobody really knows who created the Caesar cipher.
  • While the origin of the Caesar cipher is lost in history, Divus Iulius did help have it named after him, as he certainly contributed to popularizing the Caesar shift cipher.

Before we focus on explaining what a shift cipher is, we must answer one extremely important question. Suetonius explains how to decode the Caesar cipher, but if I have an extremely important secret message which cannot fall into the hands of an enemy, how can I encode it with the Caesar cipher?

Let us reread the passage of Suetonius. To decode a Caesar's message, one has to substitute each letter with the letter that stands three places to the left in the alphabet, so:

  • D with A;
  • E with B, and
  • F with C, etc.

It is easy to guess what Caesar had to do to encode the message: he substituted each letter with the letter that stands three places to the right in the alphabet, so A got replaced with D, etc. The end of the alphabet requires some thinking. What would he do with letters like X? Well, since the letters at the very beginning of the alphabet are still very much available, the most natural thing to do is to wrap the alphabet around, so X gets replaced with A, etc.

As you can see, it is not at all hard to encode with the Caesar cipher. Its ease may be one reason why the pragmatic Roman general employed this method. This leads us to the more general notion of shift ciphers.

While we do not know if Caesar ever wondered what a shift cipher is, we can be sure he understood the principle very well!

Modern cryptographers refer to the encryption method described by Suetonius as the Caesar cipher or Caesar shift cipher. It consists of replacing each letter of the message with the letter that in the alphabet stands a given number of fields to the right or to the left, with the end of the alphabet wrapped up. (In a more sophisticated language, scientists refer to this wrapping up as the periodic boundary condition.)

Caesar's cipher is a particular instance of a shift cipher, where the shifting parameter L=3L=3 corresponds to Caesar looking three places to the right to replace each letter of his message.

We can express the principle of shifting to the left by using negative values of the integer parameter. For instance, the shift cipher with L=2L=-2 consists of replacing each letter with the letter that stands two places to the left, with the end of the alphabet wrapped up. That is, we replace:

  • D with B;
  • C with A, and
  • B with Z, etc.

It is totally possible to use a shift code without wrapping up the ends as long as one comes up with some extra symbols for the letters in the final portion of the alphabet. In fact, we have historical reports about it! And guess who was using it? Octavian August, a nephew and adopted son of our dear Julius Caesar! We can only wonder if he came up with it himself or if someone explained the trick to him! 😂

If you crave historical sources, here's the relevant passage. We can see that Octavian was not very creative: the special symbol he invented was just a double A:

Quotiens autem per notas scribit, B pro A, C pro B ac deinceps eadem ratione sequentis litteras ponit; pro X autem duplex A.
(Suetonius, Divus Augustus 88)

Which translates into...

Whenever he wrote in cipher,⁠ he wrote B for A, C for B, and the rest of the letters on the same principle, using double A for X.
(Suetonius, The Life of Augustus 88, Loeb Classical Library 1913)

Although the shift cipher follows incredibly simple rules, in cryptography it laid the foundations for far more complex methods, for instance, the Vigenère cipher invented in the Renaissance.

The surviving Caesar’s letters to Cicero and other friends do not contain, unfortunately, any passages encoded by him.

With Omni Calculator, you can, however, impersonate the great conqueror of Gallia! Suppose Gaius Julius wants to secretly tell Cicero that the die has been cast. He would then perform the following encryption:

ALEA IACTA EST → DOHD LDFWD HVW

He could get the reply that arms should yield to the toga:

FHGDQW DUPD WRJDH → CEDANT ARMA TOGAE

Don't hesitate to use Omni's Caesar cipher calculator to verify whether both Caesar and Cicero got it right!

As you can see, even though we do not know who created the Caesar cipher, this does not prevent us from sending encrypted orders in the name of Caesar!

Yes, there are testimonies about Julius Caesar and Octavian Augustus, both using shift ciphers, the latter sticking to a somewhat simplified version. However, no texts encoded by either of them survived and historians do not know who invented the shift cipher.

The shift cipher, dating back to ancient times, is impossible to pinpoint its inventor. No source claims that Julius Caesar invented the method; we only know that he was famous for using a shift cipher of length 3.

The Caesar cipher, or more generally, the shift cipher, is relatively weak as a cryptographic method. However, it is still helpful for educational purposes or to avoid inadvertent reading of, e.g., puzzle solutions or movie spoilers.

To encode with the Caesar cipher:

  1. Write down the message you want to send.
  2. Replace every letter with a letter that sits N places to the right/left in the alphabet.
  3. You can pick any integer N you like. The original Caesar cipher uses N = 3 and shifts to the right.
  4. Double check to catch any mistakes, and send the message.
  5. Congratulations, Emperor!

This article was written by Anna Szczepanek and reviewed by Steven Wooding.