What is code? Definition and examples

A Code is a system for making messages shorter or secret. To read a coded message you need a key that unlocks the code. The term also has meanings in mathematics, computing, ethics, and many other fields. In these cases, it often combines with other words, such as binary code, Morse code, and so on.

using telegraph device to send Morse codeMorse code uses combinations of long and short signals: e.g., dots and dashes.

Oxford Learner’s Dictionaries define code as “a system of words, letters, numbers or symbols that represent a message or record information secretly or in a shorter form.” This article deals primarily with this meaning. It gives some examples of other meanings at the end.

Secret codes

Secret codes, or ciphers, are messages that you need a key to unlock. The sender codes the message using the key and the receiver decodes it using the same key. Codes can be easy or hard to crack, depending on how sophisticated the key is.

An easy cipher or code to break is one that uses a straightforward substitution key. An example is “monoalphabetic shift 1.” In this key, A becomes B, B becomes C, C becomes D, D becomes E, and so forth. Using this key, CBE decodes into BAD, since C=B, B=A, and E=D.

Julius Caesar used a simple substitution key to hide his messages from his enemies. He often used monoalphabetic shift 3. The key for this is shown below:

simple substitution key

Applying some basic techniques to solving substitution ciphers can be a stimulating, fun pastime.

Transposition is also a straightforward system. A substitution key is one that replaces each letter with a different letter or symbol. A transposition key just moves the letters around.

Let us take the phrase IT IS RAINING CATS AND DOGS. Writing this phrase backwards produces the transposition cipher SGOD DNA STAC GNINIAR SI TI. Another type of simple transposition is to reverse the letters of each word but keep the words in the same position: TI SI GNINIAR STAC DNA SGOD.


Cryptography is the study of securing messages so that only senders and receivers – and not third parties – can read them.

Since the days of Julius Caesar, cryptography has progressed from simple manual keys, through complex mechanical devices, to sophisticated computer technology.

Perhaps the most famous cipher device in history is the Enigma machine that the German military used in World War II. The machine’s system of rotors and plug board was capable of generating a massive number of possible codes.

Nowadays, by harnessing the processing power of modern computers, it is possible to code and decode large tracts of encrypted text in a few seconds. The basic idea, however, remains the same: the sender and receiver have to use the same key to encode and decode the message.

Morse code

Morse code is a system of communication that uses just two types of signal – such as long and short, or dot and dash – to represent letters and numbers. It takes its name from Samuel Morse, a 19th century American artist and inventor. Together with the Morse telegraph, Morse code revolutionized global communications in the 19th century.

The rapid expansion of telegraphy meant that messages could travel long distances over land in a matter of hours instead of days or weeks. Telegraphy had a similar effect on cutting communication time across the sea. The laying of the first transatlantic cable in 1858 meant that messages that once took up to 10 days to deliver by ship arrived in a matter of hours.

Wireless transmission also relied on Morse code in its early days. The code featured in two events that stand out in history: the first transatlantic radio message that Marconi sent in 1901 and the distress signals that the ocean liner Titanic sent out on her disastrous 1912 maiden voyage.

Morse code use has declined as communications technology has advanced. On land, teleprinters allowed operators to key in messages directly using letters and numbers for printing out remotely. At sea, ships continued to use Morse code for longer, but eventually with the growth of satellite communication, they too stopped using it.

However, there are many who still use Morse, such as radio amateurs who value its simplicity and ships that cannot afford expensive high-tech equipment.

Moreover, Morse code is still a required learning element in aviation and aeronautical navigation to understand navigational aids and emergency signaling.

For fun, why not try making your own Morse code message? Use this translator to make a visual or audible version.

Morse code remains a popular method for emergency signaling due to its simplicity and effectiveness in situations where voice communication is not possible.

Binary code

Binary code is a number system that only has two symbols: 0 and 1. Computers “think” in binary because their “brain circuits” are digital – their components have two states: on and off.

The signals that travel in computer circuits are combinations of 1 (for on) and 0 (for off). They are not continuously varying like the signals in analogue circuits.

The binary system relates to the decimal system as follows:

decimal and binary numbers

Hexadecimal code

Hexadecimal code is a numbering system that uses 0 to 9 and A to F. Thus, the decimal numbers 10, 11, 12, 13, 14, and 15 are A, B, C, D, E, and F in hexadecimal. Similarly, the number 3C in hexadecimal is the number 60 in decimal notation. You can use this table to produce your own conversions.

A binary number with four digits can have 16 possible values: 0000 through to 1111. In hexadecimal, this runs from 0 to F. One hexadecimal digit is equivalent to four binary digits. This makes for a special relationship between the two systems.

Computer scientists use hexadecimal notation as a user-friendly way to represent binary codes. For instance, take the decimal number 63. It is easier to get a feel for how big this number is when you see it in hexadecimal (3F) than in binary (111111).

Web designers also use hexadecimal code. The web page language HTML specifies colors as six-digit hexadecimal numbers. Each pair of digits gives the intensity of red, green, blue (rgb) in the color. For example, #00FF00 renders a lime green color called Electric Green.

Other meanings and examples

The term code – often in conjunction with another word – also has several other meanings. The following list gives some common examples.

  • Set of instructions for a computer, e.g., Brian fixed the bug by inserting some lines of code in the program.
  • Sequence of digits at the start of an individual telephone number that identifies a country, area, town, or city, e.g., To call Nigeria from the United States, dial 011 234, followed by the area code inside the country.
  • Laws, rules, or standards for governing behavior, such as in a profession or community, e.g., The Chartered Institute of Marketing explain their Code of Professional Standards in a detailed document.

Code vs. coding

Although the two terms relate to the same field, their meanings are quite different.

  • Code

Code refers to the actual text written in a coded or programming language. In Morse code, for example, the code is the dots and dashes.

  • Coding

Coding is the action of writing this code. Coding is the activity that results in the creation of code.

A global concept

‘Code’ is a familiar concept across the world. Here is a translation of the term in the most wide spoken languages (apart from English):

Código (Spanish), Código (Portuguese), Code (German), Code (French), Codice (Italian), Kod (Polish), Код (Russian), كود (Arabic), کد (Farsi), कोड (Hindi), کوڈ (Urdu), কোড (Bengali), 程序 (Cantonese Chinese), 代码 (Mandarin Chinese), コード (Japanese), 코드 (Korean), Kode (Indonesian), Mã (Vietnamese), Kod (Turkish).

Two Videos

These two interesting video presentations, from our sister YouTube channel – Marketing Business Network, explain what ‘Code’ and ‘Coding’ are using simple, straightforward, and easy-to-understand language and examples.

  • What is Code?

  • What is Coding?