Reader Approved

How to Create Secret Codes and Ciphers

Five Methods:Using Simple Ciphers and Codes (Kids)Unlocking CodesLearning Common CodesDeciphering CiphersGrasping Standard CiphersCommunity Q&A

Codes are a way of altering a message so the original meaning is hidden. Generally, this requires a code book or word. Ciphers are processes that are applied to a message to hide or encipher information. These process are reversed to translate or decipher the message.[1] Codes and ciphers form an important part of the science of secure communication (cryptanalysis).[2]

Using Simple Ciphers and Codes (Kids)

  1. 1
    Write out words in reverse. This is a simple way of encoding messages so they can't be understood at a glance. A message like "Meet me outside" written in reverse would instead be "Teem em edistuo."
    • This code can be easily solved, but it can be useful if you think someone is trying to peek at your message.[3]
  2. 2
    Reflect the alphabet in half to encipher messages. Write out the letters A through M in a single line on a piece of paper. Directly beneath this line, write out the letters N through Z also in a single line. Change each letter of messages to the opposite letter of the two lines of letters you have written out.
    • By using a reflected alphabet, the message "Hello" would instead become "Uryyb."[4]
  3. 3
    Try pigpen cipher. Draw a tic tac toe grid on a piece of paper. Write out the letters A through I in the grid going from the left to right, top to bottom. In this example:
    • The first row is made up of the letters A, B, C.
    • The second is made up of D, E, F.
    • The last row is made up of G, H, I.[5]
  4. 4
    Create a second tic tac toe grid with dots. Draw another tic tac toe grid beside the first one. Fill the grid in with the letters J through R, similarly to the first grid. Then mark dots in each space of the grid of each row as described:
    • In the first row, starting on the left, place a dot in the lower right corner (letter I), on the bottom middle side (letter K), and in lower left corner (letter L).
    • In the second row, starting on the left, place a dot on the middle right side (letter M), on the bottom middle side (letter N), and on the middle left side (letter O).
    • In the second row, starting on the left, place a dot in the upper right corner (letter P), on the top middle side (letter Q), and in the upper left corner (letter R).[6]
  5. 5
    Write out two X shapes beneath each grid. These two X shapes will also be filled with letters to complete your pigpen cipher key. In the second X, place dots in the open spaces surrounding where the X crosses so there is a dot on each side of the center of the X. Then:
    • In the first (undotted) X shape, write S in the top of the X, T on the left side, U on the right, and V on the bottom.
    • In the second X shape, write W in the top of the X, X on the left side, Y on the right, and Z on the bottom.[7]
  6. 6
    Use the grid surrounding the letters to write in pigpen cipher. The grid shapes (including dots) surrounding letters are used as substitutes for the letters themselves. Use your pigpen cipher key to translate messages into and out of pigpen.[8]
  7. 7
    Use a date shift cipher. Choose a date. This might be something with personal significance, like a birthday or the day you graduated college, but it could be something impersonal, like the birthday of George Washington. Write out the date as an unbroken string of numbers. This is the number key.
    • For example, if you were to use George Washington’s birthday (2/22/1732), you would write it as 2221732.
    • If you’ve already agreed to use a date shift cipher with someone, you can accompany enciphered messages with a clue (like “Washington”) for the number key.[9]
  8. 8
    Encipher your message with the date shift number key. Write out your message on a piece of paper. Underneath the message, write out a single digit of the number key for each letter of your message. When you reach the last digit of the number key, repeat the key from the beginning. For example, using George Washington's birthday (2/22/1732):
    • Message: I’m hungry
    • Enciphering:
      Shift letters according to the number key, as in…
    • Coded message: K.O.J.V.U.J.T.A[10]
  9. 9
    Use a secret language, like Pig Latin. In Pig Latin, words that start with a consonant sound switch that sound to the end of the word and add “ay.” This holds true for words start with a cluster of consonants. Words that start with vowels just get “way” or “ay” added to the end of the word.
    • Consonant initial examples: pig = igpay ; me = emay ; too = ootay ; wet = etway ; hello = ellohay
    • Consonant cluster initial examples: glove = oveglay ; shirt = irtshay ; cheers = eerschay
    • Vowel initial examples: explain = explainway ; egg = eggway ; ends = endsay ; eat = eatay[11]

Unlocking Codes

  1. 1
    Recognize the limitations of codes. Code books can be stolen, lost, or destroyed. Modern cryptoanlaytic techniques and computer analysis can oftentimes break even strong codes. Even so, codes can condense long messages into a single signal word, making them great time savers.[12]
    • Codes serve as good pattern identification practice. This skill can be put to use when encoding, decoding, enciphering, or deciphering messages.
    • Codes are naturally used between close friends. Inside jokes could be thought of as a kind of "code." Try developing your code language with your best friends.
  2. 2
    Determine the goal of your code. Knowing the purpose of your code will prevent unnecessary work. If your goal is to save time, you might only need a few specific code words. If you're trying to encode detailed messages, you may need to develop a code book that is more like a dictionary.
    • Select common phrases that occur in the messages you want to encode. These are prime targets to be condensed in a code word.
    • Codes can be further complicated by using several different codes in rotation or combination. However, the more codes used, the more code books necessary for decoding.[13]
  3. 3
    Develop your code book. Condense common phrases, like "Reading you loud and clear," to something like "Roy." For every conceivable word in your encoded messages and common phrases as well, designate alternative code words.
    • Sometimes, partial code can obscure a message sufficiently. For example, if "walk" means "tango" and "museum" means "restaurant" and the previously used code word "Roy" holds its value,
      • Message: About yesterday. I wanted to say, Roy. I'll tango to the restaurant as planned. Over and out.
      • Meaning: About yesterday. I wanted to say, reading you loud and clear. I'll walk to the museum as planned. Over and out.[14]
  4. 4
    Apply your code book to messages. Use the code words in your code book to encode messages. You may find that you can save yourself time by leaving nouns (like names and pronouns like I, me, she) as plain text. However, this decision depends purely on your situation.
    • Two-part codes apply two different code books to encode or decode a message. These are much stronger than one-part codes.
  5. 5
    Use a key to encode your message, alternately. A key message, group of words, letters, symbols, or a combination of these can be used to encode information.[15] The recipient of your message will also need this key phrase or key of letters/symbols to decode the message.[16]
    • For example, with the key word "SECRET," each letter of your message would convert to the number of letters between it and the corresponding letter of the key word. As in,
      • Message: Hello
      • Encoding:
        /H/ is 11 letters away from the key /S/
        /e/ is the same (zero) as the key /E/
        /l/ is 9 letters away from the key /C/
        And so on...
      • Coded Message: 11; 0 ; 9 ; 6 ; 10
  6. 6
    Decode messages. As you receive coded messages, you'll have to make use of your code book or key word/phrase to make sense of them. This may be difficult at first, but will become more intuitive as you become more familiar with the code.[17]
    • To strengthen you encoding ability, you may want to invite your friends to join an amateur code making group. Pass messages to improve your skills.

Learning Common Codes

  1. 1
    Employ the code used by Mary, Queen of Scots. While trying to send messages during a time of political turmoil, Mary, Queen of Scots, used symbols as a substitute code for English letters and common words.[18] Some features of Mary's code you might find useful for your own crypto-education include:
    • The use of simple shapes for high frequency letters, like Mary's use of a circle for the letter /A/. This saves time while encoding.
    • Common symbols used as part of the new code language, like Mary's use of "8" as code for the letter "Y." These can confuse code breakers who might interpret this as a number and not a code symbol.
    • Unique symbols for common words. In Mary's day, "pray" and "bearer" received unique symbols, but these were more common then than they are today. Still, using symbols for frequent words and phrases saves time and adds complexity.[19]
  2. 2
    Use code phrases similar to military alerts. Code phrases can collapse a lot of meaning into a single phrase. Even many kinds of military alert, like the DEFCON system, are simply well-known codes for a state of defense readiness.[20] Come up with suitable code words/phrases in your everyday life.
    • For example, instead of saying "I've got to run to my locker" among your friends, you might use the code word "Sloppy."
    • To let your friends know that the person you want to date has entered the room, you might say the code phrase, "My cousin Bruce likes hockey, too."
  3. 3
    Encode messages with a book key code. Books are relatively easy to come by. If a book has been decided upon as the key to a code, when you receive a message you can go to a bookstore or library to look up the key to decode it.
    • For example, you might decide on using Frank Herbert's Dune, with code numbers representing the page, line, and number word starting from the left.
      • Encoded Message: 224.10.1 ; 187.15.1 ; 163.1.7 ; 309.4.4
      • Decoded Message: I'm hiding my words.
    • Different editions of books might use different page numbers. To ensure the right book is used as a key, include publication information, like edition, year published, and so on with your book key.[21]

Deciphering Ciphers

  1. 1
    Determine the suitability of using a cipher. A cipher uses an algorithm, which is like a process or transformation that is applied to a message consistently. This means that anyone who knows the cipher can translate it.[22]
    • Complex ciphers can puzzle even trained cryptanalysts. Sometimes the math behind complex ciphers can prove a suitable defense for hiding everyday messages.
    • Many cryptographers add a key, like the date, to strengthen ciphers. This key adjusts the output values by the corresponding number of the day of the month (on the first, all output values would be changed by one).[23]
  2. 2
    Invent an algorithm to apply to messages. One of the simplest ciphers you can apply is the ROT1 Cipher (sometimes called Caesar Cipher). This name simply means you should rotate a single letter forward in the alphabet for each letter of your message.[24]
    • ROT1 Message: Hello
    • ROT1 Enciphered: i ; f ; m ; m ; p
    • Caesar Ciphers can be modified to rotate forward a number of different letters of the alphabet. In concept, ROT1 and ROT13 are essentially the same.
    • Ciphers can be incredibly complex. Some require the use of coordinates, times, and other values as well. Some cipher process may require the use of a computer.
  3. 3
    Encipher messages. Use your algorithm to encrypt your messages. As you learn the enciphering process, your speed should increase. Add to your algorithm to make it more complex. For example,
    • Include a rotating condition to your cipher, like the day of the week. For each day of the week, assign a value. Adjust your cipher by this value when encrypting a message on that day.
    • Include a page number with your enciphered message. Each corresponding letter of that page will serve as a key for the message, as in,
      • 1st Deciphered Message: 7 ; 2 ; 3 ; 6 ; 3
      • Book Key: A_girl (spaces aren't counted)
        /H/ is 7 letters away from /A/
        /e/ is 2 letters away from /g/
        /l/ is 3 spaces away from /i/
        And so on...
      • Key Adjusted Message: Hello[25]
  4. 4
    Decipher messages. When you become experienced reading your cipher it should become second nature, or at least easier. As the application of these processes (algorithms) is consistent, habit will help you notice trends and gain intuition when working with this kind of cryptographic system.
    • Amateur cryptography clubs are popular online. Many of these are free and offer primers in the basics of modern ciphering.[26]

Grasping Standard Ciphers

  1. 1
    Master Morse Code. Regardless of its name, Morse Code is a cipher. Dots and dashes represent long and short electrical signals which, in turn, represent the letters of the alphabet. This enabled old-time electrical communication (telegraphs). Common letters in Morse, represented as long ( _ ) and short (.) signals, include:
    • R ; S ; T ; L : ._. ; _.. ; _ ; ._..
    • A ; E ; O : ._ ; . ; _ _ _[27]
  2. 2
    Make use of transposition ciphers. Many greats in history, like the genius Leonardo da Vinci, have written out messages as they would look reflected in a mirror. Because of this, enciphering in this fashion is often called "mirror writing." These kinds of ciphers can be difficult at first, but generally become second nature quickly.[28]
    • Transposition ciphers generally treat messages or the formation of letters visually. The image of the message is transformed to hide its meaning.[29]
  3. 3
    Convert messages to binary. Binary is the language of 1's and 0's used by computers. Combinations of these 1's and 0's can be enciphered and then deciphered with a binary key, or by calculating the values represented by the 1's and 0's for each letter communicated in a message.
    • The name "Matt" would encipher to binary as: 01001101 ; 01000001 ; 01010100 ; 01010100.[30]

Community Q&A

Add New Question
  • What should I do if someone figures out my secret code/cipher?
    wikiHow Contributor
    if it's someone who you don't want knowing, make a new code and tell all others involved that the code's been changed. If you don't mind the person knowing, explain it to them, and extend your 'inner circle'.
  • What should I do if my information is leaked?
    wikiHow Contributor
    Create a new code or modify the original code, and tell everybody but that one person that it has been modified.
  • What is the use of it?
    wikiHow Contributor
    It can be used to keep something in secret (in a group of for yourself, commonly used in diaries) or share information unnoticeable with a group of people in front of other people. This is actually really fun to create and use, especially if you add your own twist to it.
  • Do you know how I can use Morse code in school without being noticed?
    wikiHow Contributor
    Tap your foot to correspond with the dots and dashes, or write down dots and dashed to create a secret message, and pass that to the person you wish to communicate with.
  • How do I find out what a secret code is?
    wikiHow Contributor
    You can find out secret codes using Omniglot. I recommend this website as it gives the real script of all the languages in the world.
  • If a key is written with the code, won't that make the code useless?
    wikiHow Contributor
    It will not as long if the key is written as a hint. If the key is written normally and the 'enemy' knows how the code works, then it is useless.
  • How will I be able to do this if I don't have any friends?
    wikiHow Contributor
    You don't need friends to use codes and ciphers. You can use codes and ciphers to create messages for only yourself. Just make sure you don't forget the code.
  • What is the best code to use in general?
    wikiHow Contributor
    The substitution cipher is great for simplicity.
  • What if it is spreading?
    wikiHow Contributor
    Alter the code slightly so only the intended people can decipher it.
  • How does the date shift code translate?
    wikiHow Contributor
    When you give them the code, they'll know the date. They'll put it under the letters, backtrack it accordingly and voila, the code's message.
Show more answers
Ask a Question
200 characters left


    • Devise a way to encipher spaces between words as well as the words themselves. This will strengthen your code and make it harder to break. For example, you can use a letter (E, T, A, O, and N work best) instead of a space. These are called nulls.


    • Having a code or cipher does not guarantee the security of your message. Cryptanalysis may break your code, or human error, like the loss of a code book, might lead to your code getting cracked as well.

    Sources and Citations

    Show more... (27)

    Article Info

    Categories: Ciphers | Creating Secret Codes

    In other languages:

    Español: crear códigos y cifrados secretos, Português: Criar Cifras e Códigos Secretos, Italiano: Creare Codici Segreti e Messaggi Cifrati, Français: créer des codes et des chiffres secrets, Русский: создать секретный код или шифр, Deutsch: Geheimcodes und Chiffren erstellen, Nederlands: Codes en geheimschrift ontwerpen, Bahasa Indonesia: Membuat Kode dan Sandi Rahasia, Čeština: Jak vytvářet kódy a šifry, ไทย: สร้างรหัสลับ

    Thanks to all authors for creating a page that has been read 961,088 times.

    Did this article help you?