Uni-Sine
Computer ScienceData and logic

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.

Try it

Number Base Converter

Convert between binary, hex and decimal and add in binary

Go to its page

How to convert hex to decimal with the converter

  1. Open the Number Base Converter and keep Convert selected.
  2. Type the hex number in Number, for example 1A3. Upper or lower case letters are both fine.
  3. Set From to hexadecimal (16) and To to decimal (10).
  4. Read the number in decimal, binary, octal and hex, with the working for hex to decimal underneath and a place value chart.
  5. To go the other way, swap From and To. To practise, press Random problem in the Practice section.

Hex digits and place values

HexABCDEF
Decimal101112131415
Place16³16²16¹16⁰
Value4096256161

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

1A3_{16} = 1 \times 256 + 10 \times 16 + 3 \times 1 = 256 + 160 + 3 = 419

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:

DivideAnswerRemainder
500 ÷ 16314
31 ÷ 16115 = F
1 ÷ 1601

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

practice
Pick an answer, then check it.
What is the hex number 3C in decimal?

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?
Multiply each digit by its place value (1, 16, 256, 4096 from the right), treating A to F as 10 to 15, and add. 1A3 = 256 + 160 + 3 = 419.
How do you convert decimal to hex?
Divide by 16 repeatedly, keep the remainders, write 10 to 15 as A to F, and read the remainders from the last to the first. 500 becomes 1F4.
What is FF in decimal?
255: 15 × 16 + 15. It is the largest value one byte can hold.
Why is hexadecimal used?
Every group of four bits becomes a single hex digit, which makes long binary numbers short and easy to read. Hex appears in colour codes, memory addresses and MAC addresses.
Can the converter handle fractions?
Yes. It converts fractional parts too, and says when a fraction doesn't end in the new base.

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
Read next
Computer Science · CoursesLearn binary and hexadecimal: an interactive courseLearn binary and hex in 24 short sections: place value, binary, decimal and hex conversions, bits and bytes, binary addition, overflow and colour codes.