Hex to decimal converter with the working
Hexadecimal (hex) is base 16. Its digits are 0 to 9 and then A to F for 10 to 15, and each place is worth 16 times the one to its right: 1, 16, 256, 4096. To convert hex to decimal, multiply each digit by its place value and add, so 4E is 4 × 16 + 14 = 78. This hex to decimal converter is our Number Base Converter: type a hex number and it shows the decimal, binary and octal at once, with the working.
Number Base Converter
Convert between binary, hex and decimal and add in binary
How to convert hex to decimal with the converter
- Open the Number Base Converter and keep Convert selected.
- Type the hex number in Number, for example 1A3. Upper or lower case letters are both fine.
- Set From to hexadecimal (16) and To to decimal (10).
- Read the number in decimal, binary, octal and hex, with the working for hex to decimal underneath and a place value chart.
- To go the other way, swap From and To. To practise, press Random problem in the Practice section.
Hex digits and place values
| Hex | A | B | C | D | E | F |
|---|---|---|---|---|---|---|
| Decimal | 10 | 11 | 12 | 13 | 14 | 15 |
| Place | 16³ | 16² | 16¹ | 16⁰ |
|---|---|---|---|---|
| Value | 4096 | 256 | 16 | 1 |
Hex to decimal: worked examples
Example 1: two digits
4E: the left digit counts 16s and the right digit counts 1s, with E worth 14. 4 × 16 + 14 × 1 = 64 + 14 = 78. The largest two-digit hex number, FF, is 15 × 16 + 15 = 255, which is why one byte (8 bits) is written as two hex digits.
Example 2: three digits
So 1A3 in hex is 419 in decimal. The converter writes this as each digit times a power of 16, then adds.
Try one, then press Mark to check your answer in the Number Systems course.
Type the decimal value of a random two digit hex number.
Press Mark to have your answer marked in the Binary, Hexadecimal & Decimal course.
Decimal to hex
Divide by 16 repeatedly and keep the remainders, writing 10 to 15 as A to F. Then read the remainders from the last to the first. For 500:
| Divide | Answer | Remainder |
|---|---|---|
| 500 ÷ 16 | 31 | 4 |
| 31 ÷ 16 | 1 | 15 = F |
| 1 ÷ 16 | 0 | 1 |
Reading up, 500 in decimal is 1F4 in hex. Check: 1 × 256 + 15 × 16 + 4 = 500.
Hex to binary
Each hex digit is exactly four binary digits (a nibble), because 16 = 2⁴. Write each digit as four bits: 3B is 3 = 0011 and B = 1011, so 0011 1011, or 111011 without the leading zeros (59 in decimal). Going from binary to hex, group the bits in fours from the right. This is why programmers use hex: it is a short way to write binary.
Hex colour codes
A web colour such as #FF8000 is three bytes: red FF, green 80 and blue 00. In decimal those are 255, 128 and 0: full red, half green and no blue, which makes orange. Each pair runs from 00 (0) to FF (255).
Try one
Common mistakes
- Using powers of 10. Hex places are powers of 16: 1, 16, 256, 4096.
- Treating letters as two digits. A to F are single digits worth 10 to 15.
- Reading remainders the wrong way. The last remainder is the first hex digit.
- Writing a remainder of 10 or more as two digits. 12 is C, not 12.
- Grouping bits from the left when converting binary to hex. Group from the right.
Common questions
How do you convert hex to decimal?
How do you convert decimal to hex?
What is FF in decimal?
Why is hexadecimal used?
Can the converter handle fractions?
Revision cards
Read the front, say your answer, then flip to check.
Where to go next
- Solve it
Number Base Converter
Convert between binary, hex and decimal and add in binary
Open the tool - Learn it
Binary, Hexadecimal & Decimal
How computers count, and how to convert between number systems
Start the course - Test it
AP Computer Science Principles
A new exam-style paper every day, with instant marking and a mark scheme
Start today's paper