- #1

Rubik

- 97

- 0

How do you convert hexadecimal numbers into bianry bits?

You are using an out of date browser. It may not display this or other websites correctly.

You should upgrade or use an alternative browser.

You should upgrade or use an alternative browser.

- Thread starter Rubik
- Start date

- #1

Rubik

- 97

- 0

How do you convert hexadecimal numbers into bianry bits?

- #2

cepheid

Staff Emeritus

Science Advisor

Gold Member

- 5,196

- 38

So, take the hexadecimal number, and just convert each hex digit in it into a four-bit binary number. The result will be the correct binary number.

- #3

cepheid

Staff Emeritus

Science Advisor

Gold Member

- 5,196

- 38

e.g. 13 (decimal) = d (hex)

A binary number is just a sum of powers of 2. You divide the number by 2. If the remainder is 1, you know that there is a 1 in the 2

13/2 = 6 r 1

Binary result so far: _ _ _ 1

Now you apply this procedure (subtract 1 if odd and then divide by 2) recursively to the result. In binary, dividing by 2 is like getting rid of the least significant bit, and shifting all the other bits to the right by one place. So, when considering whether 6 is even or odd, now you're considering whether the bit in the 2

6/2 = 3 r 0

Binary result so far: _ _ 0 1

3/2 = 1 r 1

Binary result so far: _ 1 0 1

1/2 = 0 r 1

Binary result: 1 1 0 1

Check:

1101 = 2

Thoughts?

- #4

HallsofIvy

Science Advisor

Homework Helper

- 43,021

- 973

That's a standard method of converting decimal numbers to binary, and could be used to convert individual hex "digits" to binary.

But once you have learned that

[itex]1_{16}= 1_2[/itex], [itex]2_{16}= 10_2[/tex], [itex]3_{16}= 11_2[/itex], [itex]4_{16}= 100_2[/itex], [itex]5_{16}= 101_2[/itex], [itex]6_{16}= 110_2[/itex], [itex]7_{16}= 111_2[/itex], [itex]8_{16}= 1000_2[/itex], [itex]9_{16}= 1001_2[/itex], [itex]A_{16}= 1010_2[/itex], [itex]B_{16}= 1011_2[itex], [itex]C_{16}= 1100_2[/itex], [itex]D_{16}= 1101_2[/itex], [itex]E_{16}= 1110_2[/itex], [itex]F_{16}= 1111_2[/itex]

converting hexadecimal to binary is much simpler because [itex]16= 2^4[/itex].

For example, to change [itex]34A31FB_{16}[/itex] to binary, write each digit in binary and combine them: [itex](0011)(0100)(1010)(0011)(0001)(1111)(1011)_2[/itex][itex]= 11010010100011000111111011_2[/itex].

But once you have learned that

[itex]1_{16}= 1_2[/itex], [itex]2_{16}= 10_2[/tex], [itex]3_{16}= 11_2[/itex], [itex]4_{16}= 100_2[/itex], [itex]5_{16}= 101_2[/itex], [itex]6_{16}= 110_2[/itex], [itex]7_{16}= 111_2[/itex], [itex]8_{16}= 1000_2[/itex], [itex]9_{16}= 1001_2[/itex], [itex]A_{16}= 1010_2[/itex], [itex]B_{16}= 1011_2[itex], [itex]C_{16}= 1100_2[/itex], [itex]D_{16}= 1101_2[/itex], [itex]E_{16}= 1110_2[/itex], [itex]F_{16}= 1111_2[/itex]

converting hexadecimal to binary is much simpler because [itex]16= 2^4[/itex].

For example, to change [itex]34A31FB_{16}[/itex] to binary, write each digit in binary and combine them: [itex](0011)(0100)(1010)(0011)(0001)(1111)(1011)_2[/itex][itex]= 11010010100011000111111011_2[/itex].

Last edited by a moderator:

- #5

Mensanator

- 105

- 0

How do you convert hexadecimal numbers into bianry bits?

You can use a simple lookup table to convert a hex character to its binary equivalent:

0:0000 1:0001 2:0010 3:0011

4:0100 5:0101 6:0110 7:0111

8:1000 9:1001 A:1010 B:1011

C:1100 D:1101 E:1110 F:1111

- #6

Rubik

- 97

- 0

- #7

HallsofIvy

Science Advisor

Homework Helper

- 43,021

- 973

- #8

Mark44

Mentor

- 36,856

- 8,899

Do you mean convert a binary number to a sum of powers of 2?

If that's what you mean, binary numbers work the same way as decimal numbers, where each binary or decimal place represents some power of 2 or 10.

For example, 413

101110

Share:

- Last Post

- Replies
- 2

- Views
- 508

- Last Post

- Replies
- 7

- Views
- 399

- Replies
- 38

- Views
- 2K

- Replies
- 1

- Views
- 269

- Replies
- 56

- Views
- 3K

- Last Post

- Replies
- 11

- Views
- 384

- Last Post

- Replies
- 5

- Views
- 283

- Last Post

- Replies
- 3

- Views
- 511

- Last Post

- Replies
- 1

- Views
- 408

- Last Post

- Replies
- 6

- Views
- 516