Decoding Hexadecimal: Converting Base-16 to Decimal
Instantly translate complex Base-16 computer codes into readable numbers using our Hex to Decimal Converter, or read on to master the math of hexadecimal conversion.
If you are a web developer, you use Hexadecimal (Base-16) every single day. When you write CSS and set a background color to #FF5733, you are writing in Hex.
Hexadecimal is used by programmers because it compresses massive binary strings into incredibly short, readable codes. But how do you convert that strange mixture of letters and numbers back into standard human numbers (Base-10)?
The Base-16 Dictionary
The decimal system is Base-10 (using digits 0-9). Hexadecimal is Base-16. It needs 16 unique single-character symbols.
Because we only have 10 numeric digits, Hexadecimal borrows the first six letters of the alphabet to represent the numbers 10 through 15.
The Hex Dictionary:
- 0 through 9 = 0 through 9
- A = 10
- B = 11
- C = 12
- D = 13
- E = 14
- F = 15
The Positional Method (Powers of 16)
Just like decimal uses powers of 10 (1s column, 10s column, 100s column), Hexadecimal uses powers of 16.
Reading from right to left, the columns in a Hex number are:
- Position 1:
16^0= The 1s column - Position 2:
16^1= The 16s column - Position 3:
16^2= The 256s column - Position 4:
16^3= The 4,096s column
To convert a Hex string to decimal, you simply multiply the digit in each column by its positional value, and then add them all together.
Example 1: A Two-Digit Hex Code (1A)
Convert the Hex code 1A to decimal.
- Look at the right digit (A). The dictionary says A = 10.
Multiply by the 1s column:
10 × 1 = 10. - Look at the left digit (1).
Multiply by the 16s column:
1 × 16 = 16. - Add them together:
10 + 16 = 26. The Hex code 1A equals 26 in decimal.
Example 2: A Massive Hex Code (2F4)
Convert the Hex code 2F4 to decimal.
- Right digit (4):
4 × 1 = 4 - Middle digit (F = 15):
15 × 16 = 240 - Left digit (2):
2 × 256 = 512 - Add them together:
4 + 240 + 512 = 756. The Hex code 2F4 equals 756 in decimal.
Why Colors Use Hexadecimal
In web design, colors are created using the RGB model (mixing Red, Green, and Blue light). A computer monitor can display 256 levels of intensity for each color, ranging from 0 to 255.
If you wanted to write the code for pure red in decimal, you would have to write: rgb(255, 0, 0).
In Hexadecimal, the number 255 is represented by exactly two characters: FF.
Therefore, the Hex color code for pure red is simply #FF0000.
- FF (255 Red)
- 00 (0 Green)
- 00 (0 Blue)
Hexadecimal allows the computer to perfectly compress 16 million different color combinations into strict, uniform 6-character strings.
FAQ
Why are MAC addresses written in Hexadecimal?
Every network card in the world has a unique MAC address. A MAC address is a massive 48-bit number. If you wrote a 48-bit number in binary, it would be a completely unreadable string of 48 ones and zeros. By converting it to Hexadecimal, the exact same data is compressed into just 12 characters (e.g., 00:1A:2B:3C:4D:5E), making it infinitely easier for network administrators to read and type.
Converting long strings of letters and numbers by hand is highly prone to mathematical error. Decode Base-16 instantly using the CalcUnit Hex to Decimal Converter.
