Learn

Hexadecimal (base 16), often called “hex,” is a convenient and concise way to represent binary numbers on a computer. Hex numbers are often used for values like colors and any other place where we need to represent bits more space efficiently.

Every four binary digits become a single hexadecimal digit, which simplifies conversions between the two bases. Because hexadecimal is base 16, we must have 16 numerals, including zero. Here is the standard representation for the 16 numerals (remember to scroll to see the entire table):

Decimal Hexadecimal
0 0
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 A
11 B
12 C
13 D
14 E
15 F

Notice the use of the letters A, B, C, D, E, and F, which means “15” (F) is the largest numeral in any column.

Let’s look at one hex digit to four binary digits:

0xA9FC = 0b1010100111111100

Let’s expand that so we can see the results more easily:

0x A 9 F C = 0b 1010 1001 1111 1100

Instructions

1.

What is the highest value in any column in hexadecimal notation? Remember, the most common programming formats use upper-case letters. For example, the highest value in octal (base 8) in any column is 7.

Set your answer to checkpoint_1 in the code editor. Remember to use the hexadecimal notation.

2.

What is 0x03 in binary? It is okay to do this by inspection without using division.

Set your answer to checkpoint_2 in the code editor. Remember to use any necessary prefix.

Take this course for free

By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.
Already have an account?