Learn

We use the same division technique for octal and binary to convert decimal to hexadecimal, except we divide using 16. We will use decimal 112 again.

Division by 16 Remainder Hex
112 / 16 = 7 0 0
7 / 16 = 1 7 7

We can read the table hex values from the bottom up to find our final hex. Hence, we have decimal 112 as 0x70. Note that hexadecimal is more compact at storing large numerical values than binary, octal, and decimal.

Let’s try again with decimal 4156 (remember to scroll):

Division by 16 Remainder Hex
4156 / 16 = 259 12 C
259 / 16 = 16 3 3
16 / 16 = 1 0 0
1 / 16 = 0 1 1

Reverse our final column by reading upwards, and we get 0x103C in the standard hex notation for most computer languages.

Instructions

1.

Convert decimal 1543 to its hexadecimal equivalent.

Assign your answer to checkpoint_1 in the code editor. Be sure to include any necessary prefix.

2.

If we see a fraction in the last row of our table, what number do we use to multiply the fraction for our final value?

Assign your answer to checkpoint_2 in the code editor. Be sure to include any necessary prefix.

3.

Convert decimal 2748 to its hexadecimal equivalent.

Assign your answer to checkpoint_3 in the code editor. Be sure to include 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?