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
- 1The binary place values, left to right, are 128 64 32 16 8 4 2 1.
- 2128 fits into 173: write 1, leaving 45.
- 364 doesn't fit into 45: write 0.
- 432 fits into 45: write 1, leaving 13.
- 516 doesn't fit into 13: write 0.
- 68 fits into 13: write 1, leaving 5.
- 74 fits into 5: write 1, leaving 1.
- 82 doesn't fit into 1: write 0.
- 91 fits into 1: write 1, leaving 0.
- 10Result: 10101101
Decimal to hexadecimal
- 1173 ÷ 16 = 10 remainder 13, which is the digit D.
- 210 ÷ 16 = 0 remainder 10, which is the digit A.
- 3Read the remainders from the last division back to the first: AD.
- 4Result: 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.
More free tools
IPv4 subnet calculator
Network, broadcast, usable range, and host count for any address and prefix, with the working shown.Subnetting practice
Unlimited subnetting questions. Answer, check, and see the block-size method worked through.Port and protocol reference
The well-known ports for CompTIA A+ and CompTIA Network+, each linked to its IANA registry entry.
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.