Hex to Decimal Converter
Going the other way? Convert decimal back to hex →
How do you convert hex to decimal?
Hex to decimal conversion gives each digit the weight of its position, multiplies the digit by that weight, and adds the products together.
- Number the positions from the right, starting at 0.
- Give each position the weight 16ⁿ, so the rightmost digit is worth 1.
- Multiply every digit by its weight and add the products.
- The total is the decimal value: 9C = 156.
Hexadecimal to Decimal Conversion Table
One hexadecimal digit equals exactly 4 bits (16 = 2⁴); one octal digit equals exactly 3 bits (8 = 2³). Hex and octal are therefore converted by grouping bits, and hex ↔ octal passes through binary. That is the whole method, so the table below is the only thing you need: every group of 4 bits has exactly one hex digit, and the mapping never changes. Binary writes values on the digit set 0, 1 with each place worth 2ⁿ, and a value marked 0b is binary; hex values are marked 0x.
| 4 bits | Hex | Decimal |
|---|---|---|
| 0000 | 0 | 0 |
| 0001 | 1 | 1 |
| 0010 | 2 | 2 |
| 0011 | 3 | 3 |
| 0100 | 4 | 4 |
| 0101 | 5 | 5 |
| 0110 | 6 | 6 |
| 0111 | 7 | 7 |
| 1000 | 8 | 8 |
| 1001 | 9 | 9 |
| 1010 | A | 10 |
| 1011 | B | 11 |
| 1100 | C | 12 |
| 1101 | D | 13 |
| 1110 | E | 14 |
| 1111 | F | 15 |
Each base is defined by three things: which digits it uses, how a value is marked, and what each position is worth.
| Base | Radix | Digits | Prefix | Place worth | Typical range |
|---|---|---|---|---|---|
| Hexadecimal | 16 | 0–9, A–F (A=10 … F=15; case-insensitive) | 0x | 16ⁿ | 2 digits cover a byte (00–FF); 6 digits = RGB colour; 8 digits = 32-bit word |
| Decimal | 10 | 0–9 | none | 10ⁿ | any; decimal pages treat 0–255 as the byte range |
Worked Example: 9C to Decimal
One value, converted the long way so the working is visible. This is the same grid the converter shows when you turn on "show steps".
Result: 9C = 156
Number the positions from the right, starting at 0. Each position is worth 16 raised to that number, so the rightmost digit is worth 1, the next 16, the next 256, and so on up the value.
That turns 9C into 9 x 16^1 + C x 16^0, which adds up to 156. Digits that are 0 contribute nothing and can be skipped, but the position still counts — dropping a zero shifts every digit to its left and changes the value. This is the same expansion decimal itself uses; only the base in the weights differs.
Check it in reverse
The value returns unchanged. Convert 156 back and you get 9C, because a base change rewrites the digits without touching the quantity they stand for. That is the whole test: if the round trip differs, a digit was misread. To check it by hand, convert the hex value back to decimal and compare it with the number you started from.
Worked examples: hex to decimal
Each example gives the value first, then the working. Click a value to load it in the converter.
What is 0xFF in decimal?
0xFF in hexadecimal is 255 in decimal.
Method: multiply each digit by its place value and add the products.
What is 0x9C in decimal?
0x9C in hexadecimal is 156 in decimal.
Method: multiply each digit by its place value and add the products.
What is 0x2F in decimal?
0x2F in hexadecimal is 47 in decimal.
Method: multiply each digit by its place value and add the products.
What is 0xA in decimal?
0xA in hexadecimal is 10 in decimal.
Method: multiply each digit by its place value and add the products.
What is 0x64 in decimal?
0x64 in hexadecimal is 100 in decimal.
Method: multiply each digit by its place value and add the products.
What is 0x8 in decimal?
0x8 in hexadecimal is 8 in decimal.
Method: multiply each digit by its place value and add the products.
What is 0x10 in decimal?
0x10 in hexadecimal is 16 in decimal.
Method: multiply each digit by its place value and add the products.
What is 0x20 in decimal?
0x20 in hexadecimal is 32 in decimal.
Method: multiply each digit by its place value and add the products.
What is 0x40 in decimal?
0x40 in hexadecimal is 64 in decimal.
Method: multiply each digit by its place value and add the products.
What is 0x80 in decimal?
0x80 in hexadecimal is 128 in decimal.
Method: multiply each digit by its place value and add the products.
What is 0xC in decimal?
0xC in hexadecimal is 12 in decimal.
Method: multiply each digit by its place value and add the products.
What is 0xF in decimal?
0xF in hexadecimal is 15 in decimal.
Method: multiply each digit by its place value and add the products.
What is 0x14 in decimal?
0x14 in hexadecimal is 20 in decimal.
Method: multiply each digit by its place value and add the products.
What is 0x19 in decimal?
0x19 in hexadecimal is 25 in decimal.
Method: multiply each digit by its place value and add the products.
What is 0x32 in decimal?
0x32 in hexadecimal is 50 in decimal.
Method: multiply each digit by its place value and add the products.
What is 0xC8 in decimal?
0xC8 in hexadecimal is 200 in decimal.
Method: multiply each digit by its place value and add the products.
What is 0x3E8 in decimal?
0x3E8 in hexadecimal is 1000 in decimal.
Method: multiply each digit by its place value and add the products.
What is 0x5 in decimal?
0x5 in hexadecimal is 5 in decimal.
Method: multiply each digit by its place value and add the products.
What is 0x7 in decimal?
0x7 in hexadecimal is 7 in decimal.
Method: multiply each digit by its place value and add the products.
What is 0x9 in decimal?
0x9 in hexadecimal is 9 in decimal.
Method: multiply each digit by its place value and add the products.
Every example above reverses exactly — divide the same value down to hex digits.
What About Padding, Fractions and Width?
Leading zeros and width
A number carries no leading zeros unless a width is fixed. 156 and 0156 are the same value, so the converter writes the short form. Fixed widths belong to bytes and registers, not to arithmetic. the method behind every converter here covers where width does matter.
Fractions and the point
Digits after a point convert by the same rule with negative powers, so the first place after the point is worth 1/10. Many fractions that end neatly in decimal repeat forever in binary, which is where rounding creeps in.
Negative values
A minus sign is kept in front of the digits. Fixed-width binary encodes sign differently, using two's complement, and that is a separate rule from the base change itself.
How large a value can be
The method has no ceiling; each extra hexadecimal digit multiplies the range by 16. Practical limits come from the width a machine stores the value in, not from the conversion.
Hex to Decimal in Code
The same rule in one line. Both read the digits and return the decimal total.
Python: int('9C', 16) JavaScript: parseInt('9C', 16) Common Mistakes
- Reading the remainders top to bottom. They come out in reverse, so the digits land backwards.
- Using a digit the base does not have — an 8 in octal, or a 2 in binary. The value cannot be read at all.
- Grouping bits from the left. Groups are counted from the right, and the leftmost group is the one that gets padded.
- Treating the result as a character code. 41 is a number here, not the letter A.
Frequently Asked Questions
What is endianness (big-endian vs little-endian)?
It is the order the bytes of a multi-byte value are stored in. Big-endian puts the most significant byte first, so 9C 01 reads as 9C01; little-endian puts it last, and the same two bytes read as 019C. This converter takes the digits in the order you type them.
Can you enter hex with a 0x or # prefix?
Yes. Both are stripped before the digits are read, so 0x9C, #9C and 9C all give 156. 0b marks binary, 0o octal, 0x hexadecimal; a leading # marks a hex colour. Hexadecimal is not case-sensitive (FF = ff); iToolHub writes hex digits in uppercase.
What are A to F worth in hexadecimal?
A is 10, B is 11, C is 12, D is 13, E is 14 and F is 15; the digit set is 0–9, A–F (A=10 … F=15; case-insensitive). Each takes the weight of its column, so in 9C the 9 is worth 9 × 16 and the C is worth 12, giving 156.
How do you read a hex memory address or MAC address as decimal?
The same way as any hex number: multiply each digit by its power of 16 and add the products. Both are written in hex because one byte is exactly two digits, so a six-byte MAC address is twelve of them and the byte 1B is 27.
Place value works in both directions, so the same value converts straight back in the decimal to hex direction.
Related Conversions
The rest of the family sits on the binary converter index.