top of page
  • Writer's pictureRupam Dutta

Understanding Hexadecimal Number System

Updated: Sep 6, 2022

Hexadecimal, modeled on classical greek hexadeca, means sixteen.

Hexadecimal is a number system having 16 as its base. Decimal number system has 10 digits like - 0,1,2,3,4,5,6,7,8 & 9. Like that Hexadecimal number system has 16 digits like - 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E & F ( or 0,1,2,3,4,5,6,7,8,9,a,b,c,d,e & f ).


Relation between Hexadecimal & Decimal -

Hexadecimal numbers are usually prefixed with the characters '0x' which are not part of the number.

0x0= (0)₁₀

0x1= (1)₁₀

0x2= (2)₁₀

.............

0x9= (9)₁₀

0xA= (10)₁₀

0xB= (11)₁₀

.............

0xF= (15)₁₀

0x10= (16)₁₀

0x11= (17)₁₀

..............

0x63= (99)₁₀

0x64= (100)₁₀ (Decimal is using 3 digits but Hex only 2)

..............

0xCE= (206)₁₀

0xCF= (207)₁₀

..............

0xFE= (254)₁₀

0xFF= (255)₁₀

255 is a Decimal number which is equal to the Binary number 11111111 (a full byte). So, 2 digit largest hex number 'FF' is a full byte (8 bits).

That's why, 4 digit largest hex number 'FFFF' is 2 byte (16 bits).

0xFFFF= (65535)₁₀


Decimal to Hexadecimal Conversion:


1. Divide the decimal number by 16 (Treat the division as an integer division).  

2. Write down the remainder in Hexadecimal.

3. Divide the result again by 16 (Treat the division as an integer division).  

4. Repeat step 2 and 3 until the result is 0 or smaller than 16.

5. The hex value is the digit sequence of the smaller number and remainder from the last to first.


example-1

(132)₁₀

(132/16)= 8, remainder 4 : 4

8 can't be divided by 16 : 8

So, (132)₁₀= 0x84


example-2

(689)₁₀

(689/16)= 43, remainder 1 : 1

(43/16)= 2, remainder 11 : B

2 can't be divided by 16 : 2

So, (689)₁₀= 0x2B1


example-3

(3002)₁₀

(3002/16)= 187, remainder 10 : A

(187/16)= 11, remainder 11 : B

11 can't be divided by 16 : B

So, (3002)₁₀ = 0xBBA


Hexadecimal to Decimal conversion:


A regular Decimal number is the sum of the digits multiplied with its power of 10.

Let's take a Decimal number,

(483)₁₀ = (4×10²)+(8×10¹)+(3×10⁰)

Like that, Hexadecimal numbers are reed the same way, but each digits counts the power of 16.

To convert a Hexadecimal to a Decimal, we must start by multiplying the hex number by 16. Then, we raise it to a power of 0 and increase that power by 1 each time according to the hexadecimal number equivalent. We start from the right of the hexadecimal number and go to the left when applying the powers.


example-1

0x76

= (7×16¹)+(6×16⁰)

= 112+6

= 118


example-2

0xBBA

=(11×16²)+(11×16¹)+(10×16⁰)

=(11×256)+(11×16)+10

=2816+176+10

=3002

 

36 views0 comments

Recent Posts

See All

© 2018 - 2020 by RUPAM D. PHOTOGRAPHY.

Mentor: Rupam Dutta

Photoshop Artist | Photo Editor | Photo Retoucher

  • Instagram
  • w-facebook
  • Pinterest

Kolkata, West Bengal, India

bottom of page