I am reading about encryption, and I'm curious why in all of the examples and texts, we do not encrypt the punctuation marks.

Plain text:
hello world! my name is alice and i'm writing a super secret message to bob.

Encrypted Text:
vszzc kcfzr! am boas wg ozwqs obr w'a kfwhwbu o gidsf gsqfsh asggous hc pcp.

The above example is a simple caesar cipher, but I'm curious about other more main stream encryption algorithms. Why don't we encrypt punctuation?

I've been reading about the old school symmetric key ciphers and not modern asymmetric encryption algorithms.

  • 3
    "in all of the examples and texts, we do not encrypt the punctuation marks." - I have no idea what kind of examples you've seen but in general encryption cares only about data and not the meaning of data, i.e. punctuation marks will be encrypted the same way as any other data. Maybe you should look at more real-life examples. – Steffen Ullrich Oct 14 '18 at 11:21
  • 1
    Why was this question Downvoted? I understand that the data is the only part that is supposed to be kept secret, but the context and information associated with the data should also be kept secret. Right ? – KingJohnno Oct 14 '18 at 11:24
  • 4
    I've downvoted your question (it's not a comment) since the initial claim "Why don't we encrypt punctuation?" in your question is already obviously wrong. You generalize too much from the caesar cipher you've seen. – Steffen Ullrich Oct 14 '18 at 11:25
  • 1
    My comments matched the state of your question at the time the comments were written. Only later you've added that you only care about "old school symmetric key ciphers and not modern asymmetric encryption algorithms" - whatever this exactly means for you (there are many modern symmetric encryption algorithms, not only asymmetric ones). And, are you sure that punctuation even existed or was considered relevant (i.e. to be protected) at the time the specific "old school" ciphers you care about were created? – Steffen Ullrich Oct 14 '18 at 11:56
  • 3
    Your question makes broad statements, when what you mean to say is, "why doesn't the caesar cipher substitute punctuation?" You've made a large logic error in your question by equating all encryption algorithms as the same. To know why a specific algorithm encrypts some things and not others, you just have to understand what the steps in the algorithm are. The caesar cipher you used only substitute letters. There are some caesar ciphers that also substitute punctuation. – schroeder Oct 14 '18 at 12:54

In classical cryptography, punctuation and other non-alphabetic characters are often removed. This is because these characters can make certain attacks like frequency analysis much easier. For example, leaving spaces in the plaintext/ciphertext of a Caesar Cipher allows you to see the lengths of every word. Since there are a limited number of, say, three letter words in the dictionary, it becomes easier for an attacker to guess what the relationship is between those characters. It’s the same for periods and commas, which allow an attacker to learn information about the sentence structure.

This is not as relevant in modern cryptography since newer algorithms don’t have these same weaknesses. A somewhat related issue comes up when you use AES in ECB mode (https://blog.filippo.io/the-ecb-penguin/). This demonstrates that you still need to be aware of the encryption method you’re using and how you’re using it to make sure you’re not leaking information (in this case, repeated values in the plaintext).


Modern ciphers operate on bits / bytes. It is not like you perform disk encryption and find the punctuation marks untouched. For this the text first needs to be encoded as bits / bytes before the encryption takes place. Modern cryptography is completely agnostic about the contents of the message.

Steve made a valid remark on why Caesar ciphers of old may have removed punctuation marks from a message - if they were there in the first place.

Currently however I think that Caesar ciphers simply remove them because it is harder to create/understand an implementation of the cipher if the used alphabet is different from the common ABC. To retrieve the index within the common ABC you can just subtract the ASCII value of the letter A. Furthermore, everybody knows that you need to cycle through 26 characters: i.e. the operation is modulo 26.

For the same reason it is rather common to use either lower or uppercase characters.


This is simply because of how the Caesar cipher works. It takes an input as a string, a key as the shift number, and then rotates the plaintext alphabet characters by the key. Any other characters are ignored.

Other encryption algorithms like AES work in a different way where the entire plaintext string is encrypted with the key.

  • 1
    After (or if) the text string is encoded as an octet string (byte array) anyway. Modern ciphers operate on bits / bytes, not characters. – Maarten Bodewes Oct 25 '18 at 22:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.