# Converting Number Systems

*Stive has a 1st Class Honors Electronics Engineering degree including a high level math module and also masters level modules, from the O.U.*

## Common Number Systems Refresher

The default decimal, Base_{10}, system ideally should be annotated 0, 1_{10}, 2_{10}, 3_{10}, 4_{10}, 5_{10}, 6_{10}, 7_{10}, 8_{10}, 9_{10}, but the subscripts are omitted in everyday use.

The Decimal Base_{10} system columns

Column Name 10Mils Mils 100Ths 10Ths Ths 100s 10s Units

Base_{10} Column Value 10^{7} 10^{6} 10^{5} 10^{4} 10^{3} 10^{2} 10^{1} 10^{0}

Decimal Column Value 10Mil_{10} 1Mil._{10} 100Th._{10} 10Th._{10} 1000_{10} 100_{10} 10_{10} 1_{10}

The Binary, Base_{2}, system has two discrete numeric values of 0 and 1_{2}, equivalent to 0 and 1_{10}.

Column values are shown for an 8-bit computer binary word, for a 16-bit word the MSB column would be 2^{15} (32,768_{10}).

Column Name (MSB)128s 64s 32s 16s 8s 4s 2s 1s (LSB)

Base_{2} Column Value 2^{7} 2^{6} 2^{5} 2^{4} 2^{3} 2^{2} 2^{1} 2^{0}

Decimal Column Value 128_{10} 64_{10} 32_{10} 16_{10} 8_{10} 4_{10} 2_{10} 1_{10}

The Octal, Base_{8}, system has eight discrete numeric values of 0, 1_{8}, 2_{8}, 3_{8}, 4_{8}, 5_{8}, 6_{8}, and 7_{8}, equivalent to 0, 1_{10}, 2_{10}, 3_{10}, 4_{10}, 5_{10}, 6_{10}, and 7_{10}.

Column Name 32768s 4096s 512s 64s 8s 1s (Units)

Base_{8} Column Value 8^{5} 8^{4} 8^{3} 8^{2} 8^{1} 8^{0}

Decimal Column Value 32768_{10} 4096_{10} 512_{10} 64_{10} 8_{10} 1_{10}

The Hexadecimal, Base_{16}, system has sixteen discrete alpha-numeric values of 0, 1_{16}, 2_{16}, 3_{16}, 4_{16}, 5_{16}, 6_{16}, 7_{16}, 8_{16}, 9_{16}, A_{16}, B_{16}, C_{16}, D_{16}, E_{16}, and F_{16}, equivalent to 0, 1_{10}, 2_{10}, 3_{10}, 4_{10}, 5_{10}, 6_{10}, 7_{10}, 8_{10}, 9_{10}, 10_{10}, 11_{10}, 12_{10}, 13_{10}, 14_{10}, and 15_{10}.

Column Name 65536s 4096s 256s 16s 1s (Units)

Base_{16} Column Value 16^{4} 16^{3} 16^{2} 16^{1} 16^{0}

Decimal Column Value 65536_{10} 4096_{10} 256_{10} 16_{10} 1_{10}

## Converting Decimal Base10 to Binary Base2, (the quicker way)

Example Convert 458_{10} to Binary Base_{2}

Divide the number by 2 continuously until the value is 0.

2 ) 458 Remainder(R)

2 ) 229 (R)0

2 ) 114 (R)1

2 ) 057 (R)0

2 ) 28 (R)1

2 ) 14 (R)0

2 ) 07 (R)0

2 ) 3 (R)1

2 ) 1 (R)1

0 (R)1

Then read the binary value from the bottom (MSB) to the top (LSB) of the remainder column.

So 458_{10} is 111001010_{2}

## Converting Decimal Base10 to Octal Base8, (the quicker way)

Example Convert 916_{10} to Octal_{8}

Divide the number by 8 continuously until the value is 0.

8 ) 916 Remainder(R)

8 ) 114 (R)4

8 ) 14 (R)2

8 ) 1 (R)6

0 (R)1

Then read the octal value from the bottom to the top of the remainder column.

So 916_{10} is 1624_{8}

## Converting Decimal Base10 to Hexadecimal Base16, (the quicker way)

Example Convert 1832_{10} to Hexadecimal_{16}

Divide the number by 16 continuously until the value is 0.

16 ) 1832 Remainder(R)

16 ) 114 (R)8

16 ) 7 (R)2

0 (R)7

Then read the hexadecimal value from the bottom to the top of the remainder column.

So 1832_{10} is 728_{16}

## Longer Method of Converting, understanding the columns

Converting Decimal Base_{10} (458_{10}) to Binary Base_{2}

Converting Decimal Base_{10} (916_{10}) to Octal Base_{8}

Converting Decimal Base_{10} (1832_{10}) to Hexadecimal Base_{16}

Write the Base** _{n}** columns from the right-hand column (1s column or Binary LSB) moving left, adding more, until the Column Base

_{10}Value is greater than the decimal value to be converted (maximum required column or Binary MSB).

Write 0 in this final, maximum, column (discarded later),

Binary Base_{2} –write 1 in the next column.

Octal Base_{8} & Hexadecimal Base_{16} – calculate the next column numerical value by dividing the decimal starting value by the column Base_{10} value and write the integer obtained as the column numeric value.

Base_{2}

2^{9} 2^{8} 2^{7} 2^{6} 2^{5} 2^{4} 2^{3} 2^{2} 2^{1} 2^{0}

512_{10} 256_{10} 128_{10} 64_{10} 32_{10} 16_{10} 8_{10} 4_{10} 2_{10} 1_{10}

0 1

Base_{8}

8^{4 }8^{3 }8^{2} 8^{1} 8^{0}

4096_{10 }512_{10} 64_{10} 8_{10} 1_{10}

0 1

Base_{16}

16^{3 }16^{2} 16^{1} 16^{0}

4096_{10} 256_{10} 16_{10} 1_{10}

0 7

Base_{2} Subtract the decimal value of that column from the starting value

Base_{2} 458_{10} – 256_{10} = Remainder 202_{10}

Base_{8} & Base_{16} Multiply the integer, the column numeric value, by the column Base_{10} value and then subtract the result from the starting value

Base_{8} 916_{10} – 512_{10} = Remainder 404_{10}

Base_{16} 1832_{10} – 1792_{10} = Remainder 40_{10}

Move along all columns, writing 0 when the column Base_{10} value is greater than (>) the remainder.

When the column Base_{10} value is less than (<) the remainder –

Base_{2} Write 1 then subtract the column Base_{10} decimal value from the current remainder...

Base_{8} & Base_{16} Calculate the required column numeric value by dividing the remainder value by the column Base_{10} value and write the integer obtained, as the column numeric value, then multiply the integer by the column Base_{10} value and subtract the result from the current remainder...

... to produce a new remainder value.

Base_{2}

128_{10} < 202_{10} hence 2^{7} column = 1; 202_{10} - 128_{10} = 74_{10} (new remainder)

64_{10} < 74_{10} hence 2^{6} column = 1; 74_{10} - 64_{10} = 10_{10} (new remainder)

And so on resulting in the remaining columns being 0, 0, 1, 0, 1, 0

So 458_{10} is 111001010_{2}

Base_{8}

64_{10} < 404_{10} hence 404_{10} ÷ 64_{10} = 6; 64_{10} x 6 = 384_{10}; 404_{10} - 384_{10} = 20_{10} (new remainder)

8_{10} < 20_{10} hence 20_{10} ÷ 8_{10} = 2; 8_{10} x 2 = 16_{10}; 20_{10} - 16_{10} = 4_{10} (new remainder)

And so on, resulting in the remaining column value being 4.

So 916_{10} is 1624_{8}

Base_{16}

16_{10} < 40_{10} hence 40_{10} ÷ 16_{10} = 2; 16_{10} x 2 = 32_{10}; 40_{10} - 32_{10} = 8_{10} (new remainder)

And so on, resulting in the remaining column value being 8.

So 1832_{10} is 728_{16}

## Converting Binary Base2 to Octal Base8, Hexadecimal Base16 and Decimal Base10

Convert Binary Base_{2} (111001010_{2}) to Octal Base_{8}

Group the binary digits into groups of three beginning at the right-hand side

111 001 010

Then convert each group to Decimal Base_{10}, equivalent Base_{8}, values,

712_{8} [Check 2+(1x8)+(7x64)= 2+8+ 448= 458]

Convert Binary Base_{2} (111001010_{2}) to Hexadecimal Base_{16}

Group the binary digits into groups of four beginning at the right-hand side

1 1100 1010

Then convert to Decimal Base_{10}, equivalent Base_{16}, values,

1CA_{16} [Check 10+(12x16)+(1x16)= 10+192+ 256= 458]

Convert Binary Base_{2} (111001010_{2}) to Decimal Base_{10}

First group the columns and then convert them to either Octal or Hexadecimal (personal preference), as above, and then convert to Decimal.

## Converting Octal Base8 to Binary Base2, Hexadecimal Base16 and Decimal Base10

Convert Octal Base_{8} (712_{8}) to Binary Base_{2}

Write out the numbers in groups of three binary digits

712_{8} = 111001010_{2}

Convert Octal Base_{8} (712_{8}) to Hexadecimal Base_{16}

Write out the numbers in groups of four binary digits

Then convert these groups to Hexadecimal Base_{16} values

712_{8} = 1 1100 1010 = 1CA_{16}

Convert Octal Base_{8} (712_{8}) to Decimal Base_{10}

Calculate each individual column Base_{10} value and sum them

712_{8} = (7x64_{10}) + (1x8_{10}) + 2_{10} = 458_{10}

Convert Hexadecimal Base_{16} (916_{16}) to Binary Base_{2}

Write out the numbers in groups of four binary digits

916_{16} = 1001 0001 0110_{2} (without spaces)

## Converting Hexadecimal Base16 to Octal Base8 and Decimal Base10

Convert Hexadecimal Base_{16} (916_{16}) to Octal Base_{8}

Write out the numbers in groups of four binary digits

916_{16} = 1001 0001 0110_{2}

Then group them in threes

= 100 100 010 110_{2}

Then convert these groups to Octal Base_{8} values

= 4426_{8}

Convert Hexadecimal Base_{16} (916_{16}) to Decimal Base_{10}

Calculate each individual column Base_{10} value and sum them

916_{16} = (9x256_{10}) + (1x16_{10}) + 6_{10} = 4118_{10}

**© 2019 Stive Smyth**

## Comments

**Stephen** on June 28, 2020:

Great site.