Menu

Binary

Denary to Hexadecimal Conversion

Contents

  1. Hexadecimal Digit Values
  2. Converting Denary to Hexadecimal
  3. Converting Hexadecimal to Denary

Hexadecimal uses sixteen symbols: the digits 0 to 9 and the letters A to F. The digits keep the values you already know, but the six letters stand in for the denary values ten to fifteen.

A means ten, B means eleven, C means twelve, D means thirteen, E means fourteen and F means fifteen. Letters are used because there are only ten digit symbols and six more are needed, and a letter is easy to tell apart from a digit when you read a value. Each letter is one hexadecimal digit all by itself, yet it is worth a whole number from ten to fifteen, so a D is worth thirteen rather than one. Capitals are usual, but a lower case letter means exactly the same.

Running out of symbols

Because F is the largest single digit, no single symbol can stand for sixteen. Counting on from F works just like counting past 9 in denary: you carry into a new column on the left and start the right-hand column again at 0.

HexadecimalDenary
F15
1016
1117
1F31
2032

The hexadecimal 10 that follows F is therefore not ten — it is sixteen. The 1 sits in a new column on the left and the 0 shows that no ones are left over. The same carry happens again after 1F, where the next count is written 20.

Hexadecimal is a base-16 system, so converting a denary number to hex means working out how many sixteens it contains and what is left over. The values you need to convert sit between 0 and 255, so the answer is always one or two hex digits.

Divide by 16

Divide the denary number by 16. The whole-number result is the quotient and what is left over is the remainder. The quotient becomes the left-hand hex digit and the remainder becomes the right-hand hex digit, because in hex the left column counts sixteens and the right column counts ones. Dividing by 10 would give you denary digits instead, and dividing repeatedly by 2 would give you binary digits, so 16 is the number to use.

DenaryQuotient (÷ 16)RemainderHex
155911, written B9B
966060
13013, written DD

Write 10 to 15 as letters

Each hex digit must be a single symbol, so any quotient or remainder from 10 to 15 is written as a letter: A is 10, B is 11, C is 12, D is 13, E is 14 and F is 15. For 155 the remainder is 11, so writing it unconverted would give 911: three characters where a two-digit hex answer has two.

A two-digit answer is two separate digits, never one denary number. 9B is a 9 in the sixteens column and a B in the ones column, so it is nothing like the denary number 91.

Short answers

If the denary number is below 16, the quotient is 0, meaning there are no sixteens, so the answer is just the remainder: 13 becomes D. If the number divides exactly by 16, the remainder is 0, so the right-hand digit is 0 and you keep both digits: 96 is 6 remainder 0, written 60.

Converting hexadecimal to denary means finding the ordinary number that a hexadecimal (hex) value stands for. In a two-digit hex number, the left-hand digit sits in the sixteens column and the right-hand digit sits in the ones column, because each column is worth 16 times the one on its right.

Place values of 16 and 1

Label the columns 16 and 1. The left digit tells you how many sixteens there are, and the right digit tells you how many ones. That is why you multiply the left digit by 16 and then add the right digit. A two-digit hex value such as 3D is not “thirty-something”: it means three sixteens plus thirteen.

Hex digitCalculationValue
3 (sixteens)3 × 1648
D (ones)13 × 113
Total48 + 1361

So 3D in hexadecimal is 61 in denary.

The hex value 3D over a 16 column and a 1 column: 3 x 16 = 48 and D (13) x 1 = 13, which add up to 61.

Letters stand for 10 to 15

A to F are single hex digits with values 10 to 15: A = 10, B = 11, C = 12, D = 13, E = 14 and F = 15. Swap each letter for its value before doing the arithmetic. For E9: E = 14, so 14 × 16 = 224, and 224 + 9 gives 233.

Single digits and checking

A one-digit hex value needs no multiplication, because it sits in the ones column: 7 in hex is 7 in denary, and D in hex is 13 in denary. To check a two-digit answer, convert it back to hexadecimal; if the original digits come back, your value is correct.

Also useful