Binary, Decimal, Hex & Octal Number Base Converter
Convert binary, decimal, hexadecimal, and octal instantly. Includes 8-bit, 16-bit, and 32-bit binary representations.
Binary bit-length view
| Width | Value |
|---|---|
| 8-bit | 11111111 |
| 16-bit | 0000000011111111 |
| 32-bit | 00000000000000000000000011111111 |
| 64-bit | 0000000000000000000000000000000000000000000000000000000011111111 |
New to number bases? Binary, decimal and hex explained simply shows how each base counts and how to convert between them by hand.
How number base conversion works
A number base sets how many digits each place can hold before it carries. Decimal (base 10) uses 0–9 and each place is worth ten times the one to its right. Binary (base 2) uses only 0 and 1, so the places are worth 1, 2, 4, 8, 16 and so on. Octal (base 8) uses 0–7. Hexadecimal (base 16) uses 0–9 and then A–F for ten to fifteen.
To convert to decimal, multiply each digit by its place value and add. To convert from decimal, divide by the base repeatedly and read the remainders from last to first. Because 16 is 2⁴ and 8 is 2³, binary converts to hex by grouping bits in fours and to octal by grouping in threes, with no arithmetic at all.
Worked examples
Binary to decimal
1011 0110 = 128 + 32 + 16 + 4 + 2 = 182. Add the place values wherever there is a 1.
Decimal to binary by repeated division
45 ÷ 2 = 22 r1, 22 ÷ 2 = 11 r0, 11 ÷ 2 = 5 r1, 5 ÷ 2 = 2 r1, 2 ÷ 2 = 1 r0, 1 ÷ 2 = 0 r1. Reading the remainders upward gives 101101.
Binary to hex by grouping
1101 0111 1010: 1101 = D, 0111 = 7, 1010 = A, so the hex value is D7A, which is 3,450 in decimal.
Hex to decimal
2F = 2 × 16 + 15 = 47. 1A3 = 1 × 256 + 10 × 16 + 3 = 419.
Decimal, binary, octal and hex side by side
| Decimal | Binary | Octal | Hex |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 1 | 1 | 1 | 1 |
| 2 | 10 | 2 | 2 |
| 7 | 111 | 7 | 7 |
| 8 | 1000 | 10 | 8 |
| 9 | 1001 | 11 | 9 |
| 10 | 1010 | 12 | A |
| 15 | 1111 | 17 | F |
| 16 | 10000 | 20 | 10 |
| 31 | 11111 | 37 | 1F |
| 32 | 100000 | 40 | 20 |
| 64 | 1000000 | 100 | 40 |
| 100 | 1100100 | 144 | 64 |
| 127 | 1111111 | 177 | 7F |
| 128 | 10000000 | 200 | 80 |
| 255 | 11111111 | 377 | FF |
| 256 | 100000000 | 400 | 100 |
| 1,000 | 1111101000 | 1750 | 3E8 |
| 1,023 | 1111111111 | 1777 | 3FF |
| 1,024 | 10000000000 | 2000 | 400 |
| 4,095 | 111111111111 | 7777 | FFF |
| 65,535 | 1111111111111111 | 177777 | FFFF |
Common mistakes
- Reading the remainders top to bottom. In repeated division, the first remainder is the lowest bit, so read from the last remainder up.
- Grouping bits from the left. Group from the right and pad the leftmost group with zeros: 101101 is 10 1101 → 0010 1101 = 2D.
- Forgetting that 0x, 0b and 0o are prefixes, not digits. 0x1F is hex 1F (31); type 1F into the hex box.
- Ignoring bit width for negative numbers. Computers store negative integers in two's complement at a fixed width (8, 16, 32 or 64 bits); this tool converts non-negative whole numbers.
Frequently asked questions
What is 255 in binary?
255 decimal equals 11111111 in binary (8 bits, all ones) and FF in hexadecimal.
How do I convert decimal to binary?
Divide the number by 2 repeatedly and write down each remainder, then read the remainders from last to first. For example, 13 → 1101.
Why is hexadecimal used in computing?
Each hex digit stands for exactly 4 bits, so one byte is always two hex digits (00–FF). That makes memory addresses, byte values and color codes like #FF8800 short and easy to read.
What is FF in decimal?
FF hexadecimal equals 255 in decimal.
How do I convert binary to hex?
Group the binary digits in fours from the right and convert each group to a single hex digit (0–F).
What is 1010 in decimal?
1010 in binary is 8 + 2 = 10 in decimal (A in hex).
How many values can 8 bits hold?
2⁸ = 256 values, from 0 to 255 (00 to FF in hex).