Convert Hex, Binary to Decimal

Converting HEX to Decimal

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

Convert HEX 1ADEF to decimal

HEX F = 15 15 * 160 = 15
HEX E = 14 14 * 161 = 224
HEX D = 13 13 * 162 = 3328
HEX A = 10 10 * 163 = 40960
HEX 1 = 1 1 * 164 = 65536

Therefore, HEX 1ADEF = (15 + 224 + 3328 + 40960 + 65536) = 110063

Converting Decimal to HEX

When converting decimal to hex, we simply take the remainder and match it to a HEX character.

Convert 10253 to HEX

Calculation Remainder HEX
10253/16 13 D
640/16 0 0
40/16 8 8
2/16 2 2

Therefore, decimal 10253 = HEX 280D

To get the remainder of a number without a modulo function, e.g. 374 / 8, do the following:

374 / 8 = 46.75 0.75 * 8 = 6 Remainder is 6.

Convert Decimal to Binary

Convert 278 to binary

Explanation: Assign a 0 to whole numbers, else assign 1. Continue dividing the whole number by 2.

278 / 2 = 139 0
139 / 2 = 69.5 1
69 / 2 = 34.5 1
34 / 2 = 17 0
17 / 2 = 8.5 1
8 / 2 = 4 0
4 / 2 = 2 0
2 / 2 = 1 0
1 / 2 = 0.5 1

Therefore, 278 = Binary 100010110

Convert Binary to Decimal

Convert 10111 to decimal

Index Calculation Binary
4 (2^4) * 1 = 16 1
3 (2^3) * 0 = 0 0
2 (2^2) * 1 = 4 1
1 (2^1) * 1 = 2 1
0 (2^0) * 1 = 1 1

Therefore, 10111 = (16 + 4 + 2 + 1) = 23

Advertisements

Author: drewsymo

Developer

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s