For other uses, see Code (disambiguation).
In communications, a code is a rule for converting a piece of information (for example, a letter, word, or phrase) into another form or representation, not necessarily of the same type. In communications and information processing, encoding is the process by which information from a source is converted into symbols to be communicated. Decoding is the reverse process, converting these code symbols back into information understandable by a receiver.
One reason for coding is to enable communication in places where ordinary spoken or written language is difficult or impossible. For example, a cable code replaces words (e.g., ship or invoice) into shorter words, allowing the same information to be sent with fewer characters, more quickly, and most important, less expensively. Another example is the use of semaphore, where the configuration of flags held by a signaller or the arms of a semaphore tower encodes parts of the message, typically individual letters and numbers. Another person standing a great distance away can interpret the flags and reproduce the words sent.
In the history of cryptography, codes were once common for ensuring the confidentiality of communications, although ciphers are now used instead. See code (cryptography).