Associated Topics || Dr. Math Home || Search Dr. Math

### Binary to Hexadecimal

```
Date: 12/08/98 at 11:15:11
From: Ian hamilton
Subject: number base conversions

I am a mature student on a computing HND. We have just gone through
the followung question in class, but I am still clueless. Convert
110000001101 from base two to hexadecimal.

Please help.
```

```
Date: 12/08/98 at 12:48:27
From: Doctor Rick
Subject: Re: number base conversions

Hi, Ian. A big part of the reason that we use hexadecimal is that it is
relatively easy to convert between binary and hexadecimal. Hexadecimal
numbers are closely related to binary, but they are shorter and easier
to read than binary.

Group the binary digits into groups of 4 starting from the right:

1100 0000 1101

Each group will correspond to one hexadecimal digit. The leftmost digit
in a group is the 8's place; next come the 4's, 2', and 1's places. In
each group, take the numbers for the places that have 1's in them, and
add them together:

8421 8421 8421
1100 0000 1101
\__/ \__/ \__/
8+4    0  8+4+1
12    0   13

I did the additions in base 10, so now we need to convert base 10 to
base 16. Remember that in hexadecimal:

A = 10; B = 11; C = 12; D = 13; E = 14; F = 15

So our hexadecimal number, reading from left to right, is: C0D.

Why does this work? Each place in a hexadecimal number represents a
power of 16. Thus, the hexadecimal number C0D is 12*16^2 + 0*16 + 13.
Each place in a binary number represents a power of 2. Since 16 = 2^4,
you can write, for instance:

11    3    8    3     2
2   = 2  * 2  = 2  * 16

Therefore, 4 consecutive binary digits can be grouped and a power of
16 extracted from each:

11     10     9     8        3      2      1      0      2
a*2  + b*2  + c*2  +d*2   = (a*2  + b*2  + c*2  + d*2 ) * 16

Since a 4-digit binary number is at most 15 (decimal), each group
converts into one hex digit.

For another source on this topic, please see:

Binary Conversion
http://mathforum.org/dr.math/problems/stirling1.7.98.html

- Doctor Rick, The Math Forum
http://mathforum.org/dr.math/
```
Associated Topics:
High School Number Theory

Search the Dr. Math Library:

 Find items containing (put spaces between keywords):   Click only once for faster results: [ Choose "whole words" when searching for a word like age.] all keywords, in any order at least one, that exact phrase parts of words whole words

Submit your own question to Dr. Math
Math Forum Home || Math Library || Quick Reference || Math Forum Search

Ask Dr. MathTM
© 1994- The Math Forum at NCTM. All rights reserved.
http://mathforum.org/dr.math/