1 of 10

Hexadecimal

2 of 10

  • Most Western cultures use the decimal system (base 10) to represent numeric data.

  • As we know, computers use the binary system (base 2) to represent numeric (and indeed all) data.

  • As computer scientists, it’s useful to be able to express data the same way the computer does, but trying to parse a big chain of 0s and 1s can be annoying.

3 of 10

  • The hexadecimal system (base 16) is a much more concise way to express data on a computer system.

0 1 2 3 4 5 6 7 8 9 a b c d e f

  • Hexadecimal makes it so that a group of four binary digits (bits) can be expressed with a single character, since there are 16 possible combinations of 4 bits (0 or 1).

4 of 10

Decimal

Binary

Hex

Decimal

Binary

Hex

0

0000

0

8

1000

8

1

0001

1

9

1001

9

2

0010

2

10

1010

a

3

0011

3

11

1011

b

4

0100

4

12

1100

c

5

0101

5

13

1101

d

6

0110

6

14

1110

e

7

0111

7

15

1111

f

5 of 10

Decimal

Binary

Hex

Decimal

Binary

Hex

0

0000

0x0

8

1000

0x8

1

0001

0x1

9

1001

0x9

2

0010

0x2

10

1010

0xa

3

0011

0x3

11

1011

0xb

4

0100

0x4

12

1100

0xc

5

0101

0x5

13

1101

0xd

6

0110

0x6

14

1110

0xe

7

0111

0x7

15

1111

0xf

6 of 10

  • To convert a binary number to hexadecimal, group four bits together from right to left, padding the leftmost group with extra 0s at the front if necessary.

7 of 10

  • To convert a binary number to hexadecimal, group four bits together from right to left, padding the leftmost group with extra 0s at the front if necessary.

01000110101000101011100100111101

8 of 10

  • To convert a binary number to hexadecimal, group four bits together from right to left, padding the leftmost group with extra 0s at the front if necessary.

01000110101000101011100100111101

0100 0110 1010 0010 1011 1001 0011 1101

9 of 10

  • To convert a binary number to hexadecimal, group four bits together from right to left, padding the leftmost group with extra 0s at the front if necessary.

01000110101000101011100100111101

0100 0110 1010 0010 1011 1001 0011 1101

4 6 A 2 B 9 3 D

10 of 10

  • To convert a binary number to hexadecimal, group four bits together from right to left, padding the leftmost group with extra 0s at the front if necessary.

01000110101000101011100100111101

0100 0110 1010 0010 1011 1001 0011 1101

4 6 A 2 B 9 3 D

0x46A2B93D