Binary Codes
Definition
A binary code is a coding system in which information is represented using only two binary digits, called bits: 0 and 1.
In binary coding, groups of bits are assigned specific meanings so that numbers, characters, symbols, and other data can be encoded and decoded accurately. Binary codes may be used for:
- representing numeric values
- representing text characters
- representing machine instructions
- representing special symbols and control signals
For example, the decimal number 13 is written in binary as 1101.
Main Content
1. Binary Number System and Bits
Binary is base-2
- Unlike the decimal system, which uses 10 digits (0–9), the binary system uses only 2 digits: 0 and 1.
Bit as the smallest unit of information
- A single binary digit is called a bit. Multiple bits together form larger binary numbers and codes.
Binary values are positional, meaning each bit has a place value based on powers of 2.
For example, the binary number 10110 is calculated as:
This shows how binary numbers represent decimal values through weighted positions.
2. Types of Binary Codes
Weighted binary codes
- Each bit position has a fixed value or weight. Examples include straight binary and BCD-related codes.
Non-weighted binary codes
- Bit positions do not have fixed weights; the pattern itself carries meaning. Examples include Gray code and excess-3 code.
Binary codes are not all the same. Some are designed for numerical accuracy, while others are designed to reduce errors during transmission or simplify hardware design.
Examples:
Straight binary
- : Used for general numeric representation
BCD (Binary Coded Decimal)
- : Represents each decimal digit separately using 4 bits
Gray code
- : Changes only one bit at a time between consecutive numbers, reducing errors
Excess-3 code
- : A non-weighted code used in decimal arithmetic and error handling
For example, decimal 9 in BCD is:
- 9 → 1001
But the decimal number 25 in BCD is:
- 2 → 0010
- 5 → 0101
- So 25 → 0010 0101
3. Encoding Information with Binary
Numbers, text, and symbols can all be encoded
- Binary codes can represent many kinds of information, not only integers.
Standard encoding systems exist
- Systems such as ASCII, Unicode, and EBCDIC use binary patterns to represent characters and symbols.
Computers cannot directly understand human language. Instead, every character is converted into binary according to a coding scheme.
For example, in ASCII:
A
- = 65 in decimal = 01000001 in 8-bit binary
a
- = 97 in decimal = 01100001 in 8-bit binary
A simple ASCII character table representation:
Character Decimal Binary
A 65 01000001
B 66 01000010
C 67 01000011
This makes binary codes essential for typing, storing text, and sending messages digitally.
Working / Process
1. Identify the information to be represented
- Determine whether the data is a number, character, symbol, or control instruction.
- Example: the number 13, the letter A, or the symbol @.
2. Convert or assign a binary pattern
- If it is a number, convert it using base-2 rules.
- If it is text, use a code table such as ASCII or Unicode.
- Example: 13 → 1101; A → 01000001 in ASCII.
3. Store, transmit, or interpret the binary code
- The binary pattern is saved in memory, sent across a network, or processed by a device.
- The receiving system decodes the bits according to the same code standard.
Example of decimal-to-binary conversion by repeated division by 2:
Convert 19 to binary:
- 19 ÷ 2 = 9 remainder 1
- 9 ÷ 2 = 4 remainder 1
- 4 ÷ 2 = 2 remainder 0
- 2 ÷ 2 = 1 remainder 0
- 1 ÷ 2 = 0 remainder 1
Read remainders from bottom to top:
19 = 10011₂
Simple flow of the process:
Decimal / Character
↓
Binary code assignment
↓
Storage or transmission
↓
Decoding at destination
Advantages / Applications
Simple and reliable for electronic systems
- Binary uses two stable states, which makes circuit design easier and less error-prone.
Efficient for storage and processing
- Digital devices can rapidly store and manipulate binary data with great accuracy.
Widely used in computing and communications
- Binary codes are essential in processors, memory systems, text encoding, data transmission, networking, and digital electronics.
Binary codes are used in many real-world applications, including:
- computer memory and storage devices
- programming and machine language
- barcode systems and digital identification
- telecommunications and data transfer
- error detection and correction systems
- encoding text, images, audio, and video
For example, every image on a computer screen is ultimately stored as binary data, where pixel colors and brightness values are represented using sequences of bits.
Summary
- Binary codes use only 0 and 1 to represent information in digital systems.
- Different binary codes are used for numbers, characters, and special data.
- Binary coding is the foundation of computing and number base conversions.
- Important terms to remember: bit, binary digit, base-2, BCD, ASCII, Gray code