Hexa to ASCII & ASCII to Hexa Conversion with Example

Data in the form of text and numbers are used for programming the electronic devices. But computers cannot understand human language. They can only understand the data in the form of 0’s and 1’s. To make data interpretable by computer many number formats are being used. Some of them are the Binary number system, Octal number system, Hexadecimal number system, etc.. To make the text understandable by computers ASCII codes are used. Internal converters are used for converting data from one format to another. Hexa to ASCII conversion is discussed below. Computers refer to a standard ASCII code table for reference.


What is the Hexadecimal Number System?

Hexadecimal Number System is a positional number system used to represent numbers. It uses sixteen symbols to represent the numbers, hence the name ‘Hexa’. Symbols used by hexadecimal ar ‘ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F.’ Hexadecimal number system uses alphabets as symbols along with the numerical.

The symbols ‘0-9’ are used to represent the numbers 0-9. The symbols ‘A-F’ are used for representing numbers from ten to fifteen. Hexadecimal representation of numbers requires four decimal bits for each digit.

Uses of Hexadecimal Number System

The hexadecimal number system is popularly used by computer programmers and developers. As computers can only understand the binary bits, most of the instruction sets of the computer use binary codes. Hexadecimal numbering format is very useful when there is a large binary number to interpret, and when arithmetic operations are to be performed on the larger numbers. Hexadecimal numbers provide an easy interpretation of data by users. All modern electronic equipment uses the hexadecimal numbering format. In digital communication, the data to be transmitted is converted to hexadecimal format and transmitted over the channel for error-free communication. Processors working with a word length of 64-bit also use the hexadecimal format for the instruction set.

What is an ASCII Code?

ASCII stands for – American Standard Code for Information Interchange. It is one of the milestones of IEEE. It is a character encoding standard for electronic communication for representing letters and alphabets in computers, electronic devices, etc…ASCII was developed in the US, using the Telegraph code. In 1963 the first edition of ASCII code was published. It underwent much revision over the years, and the latest update was done in the year 1986. ASCII code is based on the English Alphabet. It has 256 character codes, which also includes 127 specified characters.

ASCII code is divided into two sets – Standard ASCII code and Extended ASCII code. Standard ASCII code represents characters such as ‘a’ to ‘z’ and digits ‘0’ to’9′. They range from 0-127 in decimal and from 00 to 7F in Hexadecimal format. These are also known as Printable characters. The code ranging from 0 to 31 contains control characters assigned to control the peripheral devices and are not printable.

Extended ASCII codes contain the symbols and characters which are mostly used in different languages. They range from 128 to 255 in decimal or 80 to FF in Hexadecimal.  Extended codes, along with the Control codes present in Standard ASCII code, are used for various communication protocols such as RS=-232, RS-485, RS-422, TTL. With the advent of time, many modifications are made in ASCII to include non-English languages.

Uses of ASCII Code

American Telephone and telegraph TWX, was the first one to use ASCII code in 1963. It was used as a seven-bit teleprinter code. From 1968, all the computers used by the United States Federal Government started using ASCII for information exchange. Until 2007, ASCII was the common character encoding standard for the World Wide Web. ASCII coding uses 1 byte for each character.

Hexa to ASCII Conversion Method

ASCII code is for encoding characters in the computers. To print an ASCII character or to display it on a monitor, the hexadecimal code specified to that character has to be used. To identify the characters it is important to know the Hexa to ASCII conversion.

ASCII uses a one-byte word for representing a character. So, split the hexadecimal into the pairs, as each digit of hexadecimal is 4-bits. For each pair, find the specified ASCII character from the ASCII lookup table.

ASCII-table
ASCII-table

Hexa to ASCII Conversion Example

To understand the conversion let us look at the example. Let us convert the Hexadecimal number ‘52696368’ into ASCII.

Step1: make pairs starting from the right-hand side. If there is an extra digit, add zero at the left-hand side to complete the pair.

 = 52 | 69 | 63 | 68.

Step2: Refer to the ASCII code table to get the character equivalent to the hexadecimal pair.

From the table, 52 = R, 69 = i, 63 = c, 68 = h

Thus the ASCII representation of the given hexadeciamal number is ‘Rich’.

ASCII to Hexadecimal Conversion Method

ASCII to hexadecimal conversion ios very useful for protecting the email addresses. In this conversion, a text string is converted into hexadecimal number string. This conversion method is the reverse process of the Hexa to ASCII conversion. Here the ASCII character is taken and the lookup table is referred to generate the Hexadecimal number.

ASCII to Hexa Conversion Example

Let us look at an example to understand the ASCII to Hexa conversion. Let us convert the text string “Hope” into a hexadecimal number.

From the ASCII table, H = 48: o  = ox6F : p = ox70 : e = ox65

Thus the hexadecimal conversion of the given ASCII string is”48 ox6f ox70 ox65″.

Encoder for Conversion

Hexa to ASCII conversion can be easily done using online converters. Computers use the JAVA program for conversion. This conversion is used for peripheral devices such as printers, displays, etc…

The algorithm used in computer systems for the conversion of ASCII values firstly converts the character into its integer equivalent from the lookup table. This integer is called the ASCII value of the given character. This integer is then converted into the Hexadecimal value.

Today, digital technology is being adopted worldwide. ASCII code is also modified to include characters and symbols from various languages. In ASCII code all the control codes are grouped together as well as all the graphic codes are also grouped together to improve the ease of usage. Convert the ASCII string ” EUPHORIA” into a Hexadecimal number.