Skip to main content
CertLighthouse

Free study tool

Binary, decimal, and hex converter

Convert an 8-bit or 16-bit value between binary, decimal, and hexadecimal. Each conversion is worked step by step, the way you'd do it on scratch paper.

Useful for CompTIA A+ Core 1 and CompTIA Network+

Convert a value

Binary 10101101, hex AD, decimal 173.

Binary
1010 1101
Decimal
173
Hexadecimal
AD

Decimal to binary

  1. 1
    The binary place values, left to right, are 128 64 32 16 8 4 2 1.
  2. 2
    128 fits into 173: write 1, leaving 45.
  3. 3
    64 doesn't fit into 45: write 0.
  4. 4
    32 fits into 45: write 1, leaving 13.
  5. 5
    16 doesn't fit into 13: write 0.
  6. 6
    8 fits into 13: write 1, leaving 5.
  7. 7
    4 fits into 5: write 1, leaving 1.
  8. 8
    2 doesn't fit into 1: write 0.
  9. 9
    1 fits into 1: write 1, leaving 0.
  10. 10
    Result: 10101101

Decimal to hexadecimal

  1. 1
    173 ÷ 16 = 10 remainder 13, which is the digit D.
  2. 2
    10 ÷ 16 = 0 remainder 10, which is the digit A.
  3. 3
    Read the remainders from the last division back to the first: AD.
  4. 4
    Result: AD

Three methods worth knowing

Decimal to binary: subtract place values

Write the place values 128, 64, 32, 16, 8, 4, 2, 1. Starting from the left, write 1 under each place value that fits into what's left and subtract it, or 0 if it doesn't fit.

Binary and hex: four bits per digit

Every hex digit is exactly four bits, so group the bits in fours from the right and convert each group: 1010 1101 is A D. Going the other way, write each hex digit as four bits.

Decimal to hex: divide by 16

Divide by 16, keep the remainder as a hex digit, and repeat with the quotient until it reaches 0. Read the remainders from last to first.

Common questions

How many values fit in 8 bits?
256, from 0 to 255. That's why each octet of an IPv4 address runs from 0 to 255.
Why does hexadecimal use letters?
Base 16 needs sixteen digits, so after 0 to 9 it uses A to F for the values 10 to 15.
Can I type a 0x or 0b prefix?
Yes. 0x works for hex and 0b for binary, and spaces or underscores between digits are ignored.

Practice that remembers where you left off

The CertLighthouse app will have these generators built in, with your progress saved and questions aimed at what you miss most. It's in development now.