NOTE: Using software to mass-download the site degrades the server and is prohibited.
If you want to read The TCP/IP Guide offline, please consider licensing it. Thank you.

The Book is Here... and Now On Sale!

Enjoy The TCP/IP Guide? Get the complete PDF!
The TCP/IP Guide

Google
Web TCP/IP Guide






Table Of Contents  The TCP/IP Guide
 9  Networking Fundamentals
      9  Backgrounder: Data Representation and the Mathematics of Computing

Previous Topic/Section
Decimal, Binary, Octal and Hexadecimal Numbers
Previous Page
Pages in Current Topic/Section
1
2
34
Next Page
Binary, Octal and Hexadecimal Arithmetic
Next Topic/Section

Decimal, Binary, Octal and Hexadecimal Number Conversion
(Page 2 of 4)

Conversions Between Binary, Octal and Hexadecimal

Okay, let's start with the easy stuff first. Conversion between binary, octal and hexadecimal is very simple, as you may have noticed in the preceding topic, where I introduced them. Each octal digit is three binary digits, and each hexadecimal digit is four binary digits. Thus, to convert from binary to octal or hex, just group the digits, and convert each group into an octal or hex digit. To go the other way, convert each hex or octal digit into a set of bits. Table 3 shows the conversions from each of the octal and hexadecimal single-digit values to binary (with decimal digits thrown in for convenience):


Table 3: Binary, Octal and Hexadecimal Digit Conversion

Binary Digits

Octal Digit

Hexadecimal Digit

Decimal Digit

0000

0

0

0

0001

1

1

1

0010

2

2

2

0011

3

3

3

0100

4

4

4

0101

5

5

5

0110

6

6

6

0111

7

7

7

1000

 

8

8

1001

 

9

9

1010

 

A

 

1011

 

B

 

1100

 

C

 

1101

 

D

 

1110

 

E

 

1111

 

F

 


Let’s look at some specific examples using larger numbers:

  • Binary to Octal: Suppose we start with the binary number 110101001010. We divide this into groups of three: (110)(101)(001)(010). Each of these, we convert to a number from 0 to 7 (which is easy to do in your head if you practice a bit). The result is (6)(5)(1)(2) or 6512 octal.

  • Hexadecimal to Binary: Let's start with the hex number 0x4D1B. We convert each digit as given in the table above. So, we have 0x4D1B = (0100)(1101)(0001)(1011) or 0100110100011011.

Previous Topic/Section
Decimal, Binary, Octal and Hexadecimal Numbers
Previous Page
Pages in Current Topic/Section
1
2
34
Next Page
Binary, Octal and Hexadecimal Arithmetic
Next Topic/Section

If you find The TCP/IP Guide useful, please consider making a small Paypal donation to help the site, using one of the buttons below. You can also donate a custom amount using the far right button (not less than $1 please, or PayPal gets most/all of your money!) In lieu of a larger donation, you may wish to consider purchasing a download license of The TCP/IP Guide. Thanks for your support!
Donate $2
Donate $5
Donate $10
Donate $20
Donate $30
Donate: $



Home - Table Of Contents - Contact Us

The TCP/IP Guide (http://www.TCPIPGuide.com)
Version 3.0 - Version Date: September 20, 2005

© Copyright 2001-2005 Charles M. Kozierok. All Rights Reserved.
Not responsible for any loss resulting from the use of this site.