kids encyclopedia robot

Hexadecimal numeral system facts for kids

Kids Encyclopedia Facts

The hexadecimal numeral system, often just called hex, is a special way of counting that uses 16 different symbols. Think of it like our normal number system, called decimal, which uses 10 symbols (0 to 9). Hexadecimal uses those same 10 numbers, plus six more symbols: A, B, C, D, E, and F. These letters stand for numbers from 10 to 15. So, hexadecimal A means 10, and hexadecimal F means 15.

Most people use the decimal system because we have ten fingers. But computers work differently. They only understand "on" or "off," which we call a binary digit (or bit). A binary number is just a string of zeros and ones, like 11011011.

It can be hard for humans to read long strings of zeros and ones. So, computer engineers found a way to group these bits to make them easier to read. They group four bits together. Four bits are called a nibble. Each nibble can represent one hexadecimal digit. This is why hexadecimal is so useful for computers! Two nibbles make a byte, which is 8 bits. Most computer operations use bytes. Hexadecimal helps us write these large binary numbers in a much shorter and easier way.

To make sure everyone knows a number is hexadecimal and not decimal, people sometimes add an "h" after it (like 63h). Software developers often put "0x" before the number (like 0x63).

Understanding Hexadecimal Values

Hexadecimal is similar to the octal number system (which uses 8 symbols) because both are easy to compare to the binary system. Hexadecimal uses a four-bit code. This means that each single hexadecimal symbol represents four binary digits. Octal uses a three-bit system.

In the decimal system, each number's position has a value: ones, tens, hundreds, and so on. In hexadecimal, each position can have 16 different values. So, the positions are the one's place, the sixteen's place, and the 256's place (which is 16 times 16). This means:

  • 1h = 1 in decimal
  • 10h = 16 in decimal
  • 100h = 256 in decimal

Here's a table showing how hexadecimal numbers compare to binary, octal, and decimal:

Hex Binary Octal Decimal
0 0 0 0
1 1 1 1
2 10 2 2
3 11 3 3
4 100 4 4
5 101 5 5
6 110 6 6
7 111 7 7
8 1000 10 8
9 1001 11 9
A 1010 12 10
B 1011 13 11
C 1100 14 12
D 1101 15 13
E 1110 16 14
F 1111 17 15
10 1 0000 20 16
11 1 0001 21 17
24 10 0100 44 36
5E 101 1110 136 94
100 1 0000 0000 400 256
3E8 11 1110 1000 1750 1000
1000 1 0000 0000 0000 10000 4096
FACE 1111 1010 1100 1110 175316 64206

How to Convert Numbers

Binary to Hexadecimal

To change a binary number into a hexadecimal number, you group the binary digits. You start from the right side and separate the binary number into groups of four digits. Then, you convert each group of four binary digits into its hexadecimal symbol using the table above (0 through F). To go from hexadecimal to binary, you do the opposite: change each hex digit into its four-digit binary equivalent.

Binary Groupings Hex
01100101 0110 0101 65
010010110110 0100 1011 0110 4B6
1101011101011010 1101 0111 0101 1010 D75A

Hexadecimal and Decimal

There are two main ways to convert a number from hexadecimal to decimal.

The first way is often used when you convert numbers by hand:

  1. Find the decimal value for each hexadecimal digit. Remember: A=10, B=11, C=12, D=13, E=14, F=15.
  2. Start with the digit on the far right. This is the "ones" place.
  3. For the next digit to the left, multiply its decimal value by 16.
  4. For the third digit from the right, multiply its decimal value by 16 squared (16x16=256).
  5. Keep going for each digit, multiplying by the next power of 16 (4096, 65536, etc.).
  6. Add up all these results to get your final decimal number.
  Position Value
6th 5th 4th 3rd 2nd 1st
Value 1048576 (165) 65536 (164) 4096 (163) 256 (162) 16(161) 1 (160)

The second way is often used in computer programs. It might look longer on paper, but it's very efficient for computers.

  1. Find the decimal value for each hexadecimal digit (A=10, B=11, etc.).
  2. Start with the digit on the far left (the most significant digit). This is your starting "sum."
  3. If there's another digit to the right, multiply your current sum by 16. Then, add the decimal value of that next digit.
  4. Repeat step 3 until you have used all the digits.

Example: Converting 5Fh and 3425h to decimal using the first method:

 
5Fh to decimal
Hex Decimal
5Fh = ( 5 x 16 ) + ( 15 x 1 )
= 80 + 15
5Fh = 95
 
3425h to decimal
Hex Decimal
3425h = ( 3 x 4096 ) + ( 4 x 256 ) + ( 2 x 16) + ( 5 x 1 )
= 12288 + 1024 + 32 + 5
3425h = 13349

Example: Converting 5Fh and 3425h to decimal using the second method:

 
5Fh to decimal
Hex Decimal
sum = 5
= (5 x 16) + 15
sum = 80 + 15 (no more digits)
5Fh = 95
 
3425h to decimal
Hex Decimal
sum = 3
= (3 x 16) + 4 = 52
sum = (52 x 16) + 2 = 834
sum = (834 x 16) + 5 = 13349
3425h = 13349

Related pages

Images for kids

See also

Kids robot.svg In Spanish: Sistema hexadecimal para niños

kids search engine
Hexadecimal numeral system Facts for Kids. Kiddle Encyclopedia.