# The 4 Types of Binary Code and Their Uses Even though you might not notice, different types of binary code power all computer applications.

Computers can only understand and communicate using the binary number system (0’s and 1’s.).

But there is a caveat: there is more than just one type of binary code.

## What is binary code?

Binary code is any data, text, or computer instructions represented using a two-symbol system. These two numeral symbols are 0 and 1. Computers and digital electronic devices can only communicate using 0’s and 1’s. For example, the text on your mobile app is in English, but there is a background coding system translating those words to binary numbers for a computer to process.

In this article, you will learn about weighted code, non-weighted code, BCD code, Excess-3 code, gray code, alphanumeric code, and error detection codes using parity method.

Let’s get started with the different classifications of binary codes.

## Types of binary code

Different types of binary code each have specific properties and uses in computers and digital electronics. For example, binary coded decimal (BCD) code provides a fast and efficient conversion of decimal numbers to binary digits.

### Four types of binary code:

• Weighted binary code
• Non-weighted binary code
• Alphanumeric code
• Error detection code

## Weighted binary code

Weighted binary code is a binary code that obeys the positional weight system. This is a system where every digit is assigned a specific weight based on its position.

### Binary weights

Binary weights are values assigned to binary numbers based on their position in binary code. They help to convert binary numbers to decimal numbers easily.

To convert 10110 to decimal system, consider the weights of this binary code.

16 , 8 , 4 , 2 , 1

These values originate from 2 to the power of their binary position: 24 , 2³ , 2² , 2¹ , 2⁰ , starting from the most significant bit (MSB) to the least significant bit (LSB).

We will only consider the weights corresponding to the 1’s in 10110 because the 0’s return 0 after multiplication. Now, let’s add the weights. 2 + 4 + 16 = 22

You can check the answer over at our binary to decimal calculator.

### Binary Coded Decimal (BCD) code

BCD code is an example of a weighted binary code. It is also known as 8421 code. In the BCD encoding method, every decimal digit is represented by a four-bit binary number. Binary Coded Decimal code allows us to convert decimal numbers into their binary equivalents easily.

We can represent 16 numbers using the BCD number system. (From 0000 – 1111). However, only the first 10 combinations are used. The last 6 code combinations (1010 to 1111) are illegal and can cause machine exception or unspecified behavior depending on the computer implementation of BCD arithmetic.

Check out the Binary Clock to see a cool implementation of the BCD binary code.

Here is a table showing the BCD system. More advanced binary code users have this table in their memory.

### Applications of Weighted Binary Code

• Weighted binary code is essential for displaying numeric values in digital devices such as voltmeters and calculators
• Weighted code, for example, Binary Coded Decimal (BCD) code facilitates convenient input/output functionality display in digital circuits
• Weighted binary code is used in complex mathematical calculations

## Non-weighted binary code

Non-weighted code is used for special applications where a binary weight is not needed. Non-weighted code does not use positional weights to convert binary code to other systems like decimal, hexadecimal, octal, or any other system. Examples of non-weighted code include excess-3 code and gray code.

### Excess-3 Code

Excess-3 code is also known as XS-3 code. Excess-3 code is a non-weighted code that is derived from the 8421 BCD code. Every number on the 8421 code is incremented by 0011 to achieve the XS-3 code. 3 is the decimal equivalent of 0011, hence the name XS-3.

Here is a table showing how Excess-3 code is derived from 8421 BCD code.

### Gray Code

Gray code is a non-weighted code that is used as a unit distance code. It cannot be used for any arithmetic operations like addition, subtraction, multiplication, and division (Boolean algebraic operations). Gray code implements a unique system where only one bit changes for every decimal number. This ensures alignment and synchronicity, thus reducing error rate.

Here is a table showing Gray code.

### Applications of non-weighted binary code

• Non-weighted binary codes are perfect for error detection because they follow an organized incrementing sequence.
• The Gray code is used in shaft position encoders. These are devices employed in electric motors to measure speed and position.

## Alphanumeric codes

Computers work with only 0’s and 1’s. However, there is a need for more advanced forms of communication with machines. This is why alphanumeric code is important. It includes 26 characters for the letters of the alphabet, and 10 more for symbols like [email protected]#\$%^&.

Alphanumeric code represents both numbers and alphabetical characters. The most common types of alphanumeric code are EBCDIC and ASCII.

### EBCDIC

EBCDIC stands for Extended Binary Coded Decimal Interchange Code. EBCDIC code is an 8-bit code that is mainly used in IBM mainframe and IBM midrange computer operating systems.

### ASCII

ASCII stands for American Standard Code for Information Interchange. ASCII code is a 7-bit code used in smaller computers. ASCII code represents the numbers from 0 to 9, ninety-five upper and lowercase letters of the alphabet, punctuation marks, and a blank space. In total, ASCII encodes 128 characters.

## Error detection codes (Parity code)

When data or instructions are electronically transmitted, there is a chance of errors during data transmission in the form of scrambling or corruption of data. In order to avoid this, error-detecting codes are utilized.

An error detection code attaches additional data to a message before sending and this determines whether the message was corrupted during data transmission.

A parity code is an error detection code where an extra bit (called a parity bit) is attached to the message to make the number of 0’s and 1’s either even or odd depending on the type of parity.

## Converting Binary Code Online

As we have seen in this article, the type of binary code used by computers and electronic systems can fall into any of these four categories: weighted, non-weighted, alphanumeric, and error detection codes.

Don’t forget to use our binary to ascii converter to convert binary code to text or vice versa.