If you're new to programming, you might wonder why hexadecimal numbers (or "hex" for short) are still used today. After all, we usually work with decimal numbers (like 1, 10, or 255) in everyday life. So why do developers and engineers still write numbers like 0xFF
, 0x1A3
, or 0x0F
?
Let’s break it down in simple terms
Hexadecimal is a base-16 number system, which means it uses 16 digits:
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E,
So, for example:
A
in hex = 10 in decimalF
in hex = 15 in decimal1F
in hex = 1×16 + 15 = 31 in decimalHexadecimal calculator lets you calculator arithmetic operation easily.
Here are some key reasons hex is still used in modern programming:
Binary (base-2) only uses 1s and 0s, like 10101010
. That’s hard to read!
But the same number in hex looks like AA
— much easier.